There are a number of directories on the server, there are php-classes in them. There is a directory N in which there are classes that need to be debugged, but in error.log nothing is written about them (there are intentional errors in the files), although errors are caught perfectly in other directories.

What's wrong? How to make the logs written correctly.

Phpinfo () data:

  • log_errors On
  • display_errors On
  • display_startup_errors On
  • error_append_string no value
  • error_log no value
  • error_prepend_string no value
  • error_reporting 32767

It is extremely confusing values ​​of no value, but in php.ini there are default values.

There is an assumption that all .htaccess has “broken”, but after its removal the picture is the same.


I tried to set up logging again in the apache2.conf file:

ErrorLog ${APACHE_LOG_DIR}/error.log 

php5.ini:

 error_reporting = E_ALL log_errors = On 

All directives regarding html errors and others are included, the result:

access.log:

 46.62.83.9 - - [16/Jan/2016:13:06:41 +0100] "POST /dir/expected_catcher.php HTTP/1.1" 200 290 "http://site/dir/" "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2618.8 Safari/537.36" 185.71.77.5 - - [16/Jan/2016:13:06:55 +0100] "POST /dir2/demo_catcher.php HTTP/1.1" 200 250 "-" "Apache-HttpClient/4.3.5 (java 1.5)" 

error.log:

 [Sat Jan 16 13:06:55 2016] [error] [client 185.71.77.5] PHP Notice: Undefined index: test_notification in /var/www/dir2/catcher.php on line 17 

In the expected_catcher.php we have an error, it cannot be caught because of the logs. Assumptions about the causes have already dried up, nothing unfortunately does not help.

    1 answer 1

    If the other directories are virtual hosts, then you need to look at the configuration of the Apache and namely the virtual hosts. There are usually log paths for all hosts. How to find configuration files can be viewed in response to SO .

    If this is the same virtual hosting or you run as a CLI , then look where the STDERR stream is STDERR .

    And more importantly what kind of errors you want to see in the logs. Fatal will always be (if STDERR is not written in /dev/null for example), and the rest can be disabled, including on the fly, via the error_reporting () function

    It is desirable for you to indicate in the question how you run the scripts and what these directories are.

    • The script that requires debugging is started upon the server accepting certain data, in my case a transaction. Directories are just document folders. The script itself is working, in another directory, a similar script works with a bang. - lamartire
    • The apache configuration path is: ErrorLog $ {APACHE_LOG_DIR} /error.log. Where in theory, everything is written. - lamartire
    • @lamartire what are these scripts and what kind of errors do you want to catch? Script on the crown starts? - korytoff
    • Not. The script is based on this class - pastebin.com/M9EvaP0u . It works when a certain set of data arrives on the server, in my case, a post-request from Yandex.nedeg, which contains information about the transaction. I would like to catch mistakes in principle, in particular syntactic ones, because it is impossible to debug a class at all. The class above works (is in a different folder and performs its actions with a bang). - lamartire
    • Added a bit of additional information to the topic header. Honestly, I don’t already know what could be the matter, but transferring files to another directory due to such difficulties is nonsense. In general, I hope at least it will be useful and will help find a solution. - lamartire