Join the community today
Become a Member

PHP-FPM php error not written on php error log file

Discussion in 'Install & Upgrades or Pre-Install Questions' started by arlon, Jan 12, 2018.

  1. arlon

    arlon Member

    91
    6
    8
    Feb 20, 2016
    Ratings:
    +12
    Local Time:
    10:04 PM
    1.13.6
    10.1
    In centminmod 123.08 stable every error on php always written on error log file:
    /var/log/php-fpm/www-php.error.log
    /var/log/php-fpm/www-error.log
    and i can review the error

    then i reinstalled my server using 23.09beta, my error log file always empty, then i try to create php contain wrong syn tax and run it and error log file still empty

    based on phpinfo i have:
    error_log location /var/log/php-fpm/www-php.error.log

    why is every php error not written? php fpm error log too not written in the file





    Please fill in any relevant information that applies to you:
    • CentOS Version: i.e. CentOS 6 64bit
    • Centmin Mod Version Installed: 123.09beta01
    • Nginx Version Installed: i.e. 1.11.10
    • PHP Version Installed: i.e. 5.6.30
    • MariaDB MySQL Version Installed: 10.1.21
    • When was last time updated Centmin Mod code base ? : i.e. run centmin.sh menu option 23 submenu option 2
    • Persistent Config: Do you have any persistent config file options set in /etc/centminmod/custom_config.inc ? You can check via this command:

      cat /etc/centminmod/custom_config.inc


      Post output in CODE tags.
     
  2. eva2000

    eva2000 Administrator Staff Member

    37,255
    8,139
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,531
    Local Time:
    1:04 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    examples of specific error messages logged ?

    123.09beta01 php-fpm.conf defaults to log level = warning centminmod/php-fpm.conf at 123.09beta01 · centminmod/centminmod · GitHub as does 123.08stable centminmod/php-fpm.conf at 123.08stable · centminmod/centminmod · GitHub so probably not the reason why.

    Tried PHP 5.6.33 ?

    When you create a new nginx vhost domain via centmin.sh menu option 2 or menu option 22 or via /usr/bin/nv cli command line, you will create the Nginx vhost files and directories. You will get an outputted the path location where it will create the domain name's vhost conf file named newdomain.com.conf (and newdomain.com.ssl.conf if you selected yes to self signed SSL)
    • Nginx vhost conf path will be at /usr/local/nginx/conf/conf.d/newdomain.com.conf
    • Nginx HTTP/2 SSL vhost conf path will be at /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf
    • Nginx Self-Signed SSL Certificate Directory at /usr/local/nginx/conf/ssl/newdomain.com
    • Vhost public web root will be at /home/nginx/domains/newdomain.com/public
    • Vhost log directory will be at /home/nginx/domains/newdomain.com/log
    Please post the contents of /usr/local/nginx/conf/conf.d/newdomain.com.conf and if applicable /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf wrapped in CODE tags (outlined at How to use forum BBCODE code tags)

    What web app ? script ? has that version of script been updated ? could be that developers disabled error logging?

    Any modifications to php settings on 123.09beta01 install ?

    If you restart nginx + php-fpm services do log entries show up ?
     
  3. arlon

    arlon Member

    91
    6
    8
    Feb 20, 2016
    Ratings:
    +12
    Local Time:
    10:04 PM
    1.13.6
    10.1
    This my config
    /usr/local/nginx/conf/conf.d/newdomain.com.conf
    Code:
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    
    # redirect from non-www to www
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    #server {
    #            listen   80;
    #            server_name mydomain.com;
    #            return 301 $scheme://www.mydomain.com$request_uri;
    #       }
    
    server {
     
      server_name mydomain.com www.mydomain.com;
      return 302 https://www.$server_name$request_uri;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/mydomain.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/mydomain.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/mydomain.com/autoprotect-mydomain.com.conf;
      root /home/nginx/domains/mydomain.com/public;
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      #include /usr/local/nginx/conf/cloudflare.conf;
      include /usr/local/nginx/conf/503include-main.conf;
    
      # prevent access to ./directories and files
      #location ~ (?:^|/)\. {
      # deny all;
      #}
    
      location / {
      include /usr/local/nginx/conf/503include-only.conf;
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # Shows file listing times as local time
      #autoindex_localtime on;
    
      # Wordpress Permalinks example
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
      }
    
      include /usr/local/nginx/conf/pre-staticfiles-local-mydomain.com.conf;
      include /usr/local/nginx/conf/pre-staticfiles-global.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php.conf;
     
      include /usr/local/nginx/conf/drop.conf;
      #include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
    
    /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf

    Code:
    # Centmin Mod Getting Started Guide
    # must read http://centminmod.com/getstarted.html
    # For HTTP/2 SSL Setup
    # read http://centminmod.com/nginx_configure_https_ssl_spdy.html
    
    # redirect from www to non-www  forced SSL
    # uncomment, save file and restart Nginx to enable
    # if unsure use return 302 before using return 301
    # server {
    #       listen   80;
    #       server_name mydomain.com www.mydomain.com;
    #       return 302 https://$server_name$request_uri;
    # }
    
    server {
      listen 443 ssl http2;
      server_name mydomain.com www.mydomain.com;
    
      if ($host = $server_name) {
          return 301 https://www.$server_name$request_uri;
        }
    
      ssl_dhparam /usr/local/nginx/conf/ssl/mydomain.com/dhparam.pem;
      ssl_certificate      /usr/local/nginx/conf/ssl/mydomain.com/mydomain.comodo.crt;
      ssl_certificate_key  /usr/local/nginx/conf/ssl/mydomain.com/mydomain.com.key;
      include /usr/local/nginx/conf/ssl_include.conf;
    
      http2_max_field_size 16k;
      http2_max_header_size 32k;
      # mozilla recommended
      ssl_ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS;
      ssl_prefer_server_ciphers   on;
      #add_header Alternate-Protocol  443:npn-spdy/3;
    
      # before enabling HSTS line below read centminmod.com/nginx_domain_dns_setup.html#hsts
      #add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
      #add_header X-Frame-Options SAMEORIGIN;
      #add_header X-Xss-Protection "1; mode=block" always;
      #add_header X-Content-Type-Options "nosniff" always;
      #spdy_headers_comp 5;
      ssl_buffer_size 1369;
      ssl_session_tickets on;
     
      # enable ocsp stapling
      resolver 8.8.8.8 8.8.4.4 valid=10m;
      resolver_timeout 10s;
      ssl_stapling on;
      ssl_stapling_verify on;
      ssl_trusted_certificate /usr/local/nginx/conf/ssl/mydomain.com/mydomain.com-trusted.crt;
    
    # ngx_pagespeed & ngx_pagespeed handler
    #include /usr/local/nginx/conf/pagespeed.conf;
    #include /usr/local/nginx/conf/pagespeedhandler.conf;
    #include /usr/local/nginx/conf/pagespeedstatslog.conf;
    
      # limit_conn limit_per_ip 16;
      # ssi  on;
    
      access_log /home/nginx/domains/mydomain.com/log/access.log combined buffer=256k flush=5m;
      error_log /home/nginx/domains/mydomain.com/log/error.log;
    
      include /usr/local/nginx/conf/autoprotect/mydomain.com/autoprotect-mydomain.com.conf;
      root /home/nginx/domains/mydomain.com/public;
      # uncomment cloudflare.conf include if using cloudflare for
      # server and/or vhost site
      #include /usr/local/nginx/conf/cloudflare.conf;
      include /usr/local/nginx/conf/503include-main.conf;
    
      location / {
      include /usr/local/nginx/conf/503include-only.conf;
    
    # block common exploits, sql injections etc
    #include /usr/local/nginx/conf/block.conf;
    
      # Enables directory listings when index file not found
      #autoindex  on;
    
      # Shows file listing times as local time
      #autoindex_localtime on;
    
      # Wordpress Permalinks example
      #try_files $uri $uri/ /index.php?q=$uri&$args;
    
      }
    
      include /usr/local/nginx/conf/pre-staticfiles-local-mydomain.com.conf;
      include /usr/local/nginx/conf/pre-staticfiles-global.conf;
      include /usr/local/nginx/conf/staticfiles.conf;
      include /usr/local/nginx/conf/php.conf;
     
      include /usr/local/nginx/conf/drop.conf;
      include /usr/local/nginx/conf/errorpage.conf;
      include /usr/local/nginx/conf/vts_server.conf;
    }
    
     
  4. eva2000

    eva2000 Administrator Staff Member

    37,255
    8,139
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,531
    Local Time:
    1:04 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    don't see anything wrong with vhosts.. and answers to other questions ?
     
  5. arlon

    arlon Member

    91
    6
    8
    Feb 20, 2016
    Ratings:
    +12
    Local Time:
    10:04 PM
    1.13.6
    10.1
    i don't modify 123.09beta01 install, error logging is not disables,
    just simple php script to test error log..

    i tried to change permission of /var/log/php-fpm/www-php.error.log file from rw-rw--- to rw-rw-rw and error log written on /var/log/php-fpm/www-php.error.log

    whats the correct owner and chmod for /var/log/php-fpm/www-php.error.log ?
     
  6. eva2000

    eva2000 Administrator Staff Member

    37,255
    8,139
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,531
    Local Time:
    1:04 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    should be root user/group
     
  7. eva2000

    eva2000 Administrator Staff Member

    37,255
    8,139
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,531
    Local Time:
    1:04 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    interesting just checked one of my servers hasn't had a www-php.error.log entry since Dec 20th which doesn't mean much by itself as it could just mean my server's free of php errors
    Code (Text):
    ls -lahrt /var/log/php-fpm | tail -20
    -rw-rw-rw-  1 root root  12K Dec 16 03:28 www-php.error.log-20171215.gz
    -rw-rw-rw-  1 root root 9.6K Dec 17 03:28 www-php.error.log-20171216.gz
    -rw-rw-rw-  1 root root 7.7K Dec 18 04:42 www-php.error.log-20171217.gz
    -rw-rw-rw-  1 root root 8.6K Dec 19 03:46 www-php.error.log-20171218.gz
    -rw-rw-rw-  1 root root 130K Dec 19 09:38 www-php.error.log-20171220
    -rw-rw-rw-  1 root root 9.2K Dec 20 03:52 www-php.error.log-20171219.gz
    -rw-rw-rw-  1 root root    0 Dec 20 03:52 www-php.error.log
    -rw-------  1 root root  650 Jan  3 04:01 www-error.log-20180102.gz
    -rw-------  1 root root  675 Jan  4 04:24 www-error.log-20180103.gz
    -rw-------  1 root root  393 Jan  6 03:52 www-error.log-20180104.gz
    -rw-------  1 root root  341 Jan  7 03:20 www-error.log-20180106.gz
    drwxr-xr-x 18 root root 4.0K Jan  7 03:20 ..
    -rw-------  1 root root  419 Jan  8 03:54 www-error.log-20180107.gz
    -rw-------  1 root root  656 Jan  9 03:30 www-error.log-20180108.gz
    -rw-------  1 root root  639 Jan 10 03:49 www-error.log-20180109.gz
    -rw-------  1 root root  671 Jan 11 03:23 www-error.log-20180110.gz
    -rw-------  1 root root 5.0K Jan 12 04:12 www-error.log-20180112
    -rw-------  1 root root  850 Jan 12 05:02 www-error.log-20180111.gz
    drwxr-xr-x  2 root root  12K Jan 12 05:02 .
    -rw-------  1 root root 1.4K Jan 12 09:12 www-error.log

    the www-error.log is for php-fpm pools itself not php errors
     
  8. arlon

    arlon Member

    91
    6
    8
    Feb 20, 2016
    Ratings:
    +12
    Local Time:
    10:04 PM
    1.13.6
    10.1
    yess, it is for php-fpm log
    and php error log is on www-php.error.log

    i can see that chmod of your www-php.error.log is 666
    PHP:
    -rw-rw-rw-  1 root root    0 Dec 20 03:52 www-php.error.log
    and my chmod of www-php.error.log is 660 by default instalation

    now i have chmoded my www-php.error.log to 666 and php error log written on www-php.error.log, not empty
     
    • Informative Informative x 1
  9. eva2000

    eva2000 Administrator Staff Member

    37,255
    8,139
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +12,531
    Local Time:
    1:04 AM
    Nginx 1.15.x
    MariaDB 5.5/10.x
    ah permissions !

    will update 123.09beta01 with a fix as well as auto check+fix on centmin.sh runs
     
..