Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is PHP not including my file when it clearly exists?

Tags:

include

php

Here is the exact problem. I have an autoload function set up with a piece of code that looks like this:

if(file_exists($class_file))
{
    include($class_file);
    return true;
}

However, when $class_file is set to a certain value, I get an include error:

Error String: include(includes/php/utilities/calendar_event_html.utility.php)
[function.include]: failed to open stream: No such file or directory

It works fine for other files and when I step through this code with a debugger it is clear that PHP believes the file exists, but it seems that include does not. Does anyone have an idea of what is going on?

like image 683
Steven Oxley Avatar asked Dec 17 '25 22:12

Steven Oxley


1 Answers

From the manual:

Note: The check is done using the real UID/GID instead of the effective one. 

This means that the file may exist, but it's possible that it is not accessible by the UID/GID your PHP instance is running with. I suggest you check the permissions to that file.

Best wishes,
Fabian

like image 147
halfdan Avatar answered Dec 20 '25 16:12

halfdan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!