Faced a very strange PHP behavior (although it may not be the case).
The script does not see (or does not have access) to files and directories located outside the directory in which the script itself is located. This behavior is observed only on the server, on lokalke everything works as it should.

The rights to the catalogs exhibited to allow everything and everyone , but it did not help.
I sin on some PHP or Apache settings, but I don’t know what to look for.
Tell me where to dig?

Server - Debian 8
PHP version 5.6.24.

  • one
    @Legionary, the name of the technologies are not highlighted by code - VenZell

2 answers 2

This behavior is related to security settings.

In this case, the directive is open_basedir

Limits files that may be accessible to PHP, including the file itself, with the specified directory tree.

  • Yes, everything is so, thank you very much. - Andrey

Good question.

And the answer to it will be useful to many users of php.

Any strange behavior is always accompanied by error messages. therefore, you need to configure your server so that it reports all errors.

for this, if possible, in php.ini or .htaccess, and in an extreme case, set the following settings directly in the script via ini_set:

  • for the site in development mode

    error_reporting = -1 display_errors = 1 

    and watch the errors right on the screen

  • for the site in combat mode

     error_reporting = -1 display_errors = 0 log_errors = 1 

    and watch the errors in the error log of web sevrera

After reading the error message, the need to write to Sportloto with the question "Where should I dig?" disappears. As well as there is no need for the services of various fortunetellers and telepaths who try to guess one of the few problems they know by indirect signs.

  • very helpful information, helped a lot. thanks a lot - Andrey