Access PHP Error Logs - Vagrant CentOS VM setup by Puphpet

5.9k views Asked by At

I have a Vagrant VM running CentOS, which was built from a puphpet file (config.yaml), and I'm trying to get the PHP error logs setup and accessible.

config.yaml - PHP section:

php:
install: '1'
settings:
    version: '56'
modules:
    php:
        - cli
        - intl
        - mcrypt
    pear: {  }
    pecl:
        - pecl_http
ini:
    display_errors: Off
    error_reporting: E_ALL & ~E_NOTICE & ~E_STRICT
    session.save_path: /var/lib/php/session
    date.timezone: America/Denver
    log_errors: On
    error_log: /var/log/php_errors.log
fpm_ini:
    error_log: /var/log/php-fpm.log
fpm_pools:
    phpfp_tg4gv8zscipk:
        ini:
            prefix: www
            listen: '127.0.0.1:9000'
            security.limit_extensions: .php
            user: www-user
            group: www-data
composer: '1'
composer_home: ''

/etc/php.d/zzzz_custom.ini

[CUSTOM]
log_errors=true
error_reporting=E_ALL & ~E_NOTICE & ~E_STRICT
session.save_path=/var/lib/php/session
cgi.fix_pathinfo=1
date.timezone=America/Denver
error_log=/var/log/php_errors.log
display_errors=false

/etc/php.ini

error_log = /var/log/php_errors.log
log_errors = On

I've done:

sudo touch /var/log/php_errors.log
sudo chown www-data: /var/log/php_errors.log
sudo chmod +rw /var/log/php_errors.log

When I run the following, I get nothing:

sudo tail -f /var/log/php_errors.log

I know there should be PHP errors as I explicitly creating them in a certain file to test, such as using undeclared functions, etc.

I've also tried not setting error_log in both the config.yaml and the php.ini file to see if the default would work, as I thought it would dump PHP errors into /var/log/httpd/error_log.

I seriously have no idea where to go from here. Any help is much appreciated!

2

There are 2 answers

0
wittyweasel On BEST ANSWER

If you let Puphpet create your vhost file, please check what error logs were specified in there. I had this problem a while back and found extra error logs when I went through all my nginx logs in /var/log.

For nginx and apache you should be checking the contents /etc/nginx/sites-available/ and /etc/apache2/sites-available/ respectively for the vhost files.

0
tobuslieven On

First thing to do is to put:

phpinfo(); 
exit; 

Into your index.php file and look for the error_log setting there. Then at least you'll know what php thinks it's doing, rather than only knowing what puphpet might be telling php to do.

Hope this is helpful.