I'm getting the following error while trying to run a CMS app.
'Fatal error: require_once(): Failed opening required 'H:/Apache2/htdocs/....funcs.php' (include_path='\**xampp\php\PEAR**')'

I've seen the same basic question floating around, but it wasn't addressed as I'd have expected. My first thought was it has something to do with the path to PEAR. in my case, my XAMPP install doesn't have pear installed. i encountered this before and ran into trouble installing PEAR and never came back to it. I used to always run Apache as a service, so XAMPP is a little different than i'm used to the way I have my directory structure setup...

Any feedback is appreciated. Thank you.

    The current include_path setting is shown as part of that error message in case you were specifying a relative path/file to be required, in which case the include_path would have been searched to find the location of the file. Since you are specifying an absolute filesystem path/file, the include_path has no relevance and you can ignore it being in the error message. The include_path setting containing an entry for the pear extension, does not mean that pear is need or installed, just that the include_path contains a default entry for it.

    You should have also gotten a WARNING message prior to that fatal error, telling you why the file could not be required. If you didn't, it means that php's error_reporting setting is not set to E_ALL. You need to find where the error_reporting setting is set at on your system and change it to be E_ALL. If it is set in a php.ini file, you will need to restart the web server to get any change made to the php.ini to take effect. After you have changed the settings, use a phpinfo(); statement in a .php script to confirm that the setting actually got changed.

    Yeah, if you get some full error reporting, it should point you to the exact file/line where the error occurred. Then we can see what it was trying to do, and figure out what needs to be changed. You could check the PHP error log, though I'm not sure where XAMPP logs them. Maybe try this in a file within your app?

    echo "<pre> error_log:\n".ini_get('error_log')."</pre>";
    

    If the Warnings are not being reported, they won't get logged or displayed.

    pbismad Even so, it looks a bit dodgy to just have an include_path of \xampp\php\PEAR. On my Ubuntu machine, it has both . and /usr/share/php:

    php -r 'var_dump(get_include_path());'
    string(16) ".:/usr/share/php"
    2 months later

    Thank you, all. I didn't realize I never acknowledged the replies here. My apologies.

    Honestly, I didn't realize that's how the PHP include path worked. I probably did, but...
    This was a very helpful thread for me. I really appreciate this forum for when I get stuck!

    😅

      Write a Reply...