I checked which php.ini is used with phpinfo(), so I'm editing the right php config file.
In that php.ini file (and in phpinfo() details) I have display_errors at On and error_reporting at E_ALL.
BUT when I have a PHP error, most of the time I find no log (in the file specified by error_log, nor in the file specified in apache vhost, nor in /var/syslog), and only a blank page displayed.
I also tried to use the ini_set("display_errors", 1) but that didn't change anything.
One thing was weird, I had no php5 folder in /var/log (I created it, and configured error_log to use it).
Any idea would be much appreciated, that's not so great to code without knowing anything about the errors you have !
P.S. I'm using PHP 5.4 & Symfony2 (using the app_dev.php file), on Debian Wheezy.
Edit : Error logs now work thanks to #martinezjc , but still having a blank page in Apache.
You can create a custom directory, remember to assign apache permission
mkdir /var/log/php-5-4
chown www-data /var/log/php-5-4
The in the php.ini file
error_log = /var/log/php-5-4/php_errors.log
This link talk about more about logs, you can check it http://doc.exyks.org/wiki/Server_php_log_configuration
Related
I've been combing through my /etc/php/7.0/apache2/php.ini and /etc/apache2/apache2.conf files while trying to set up a specific error log file to dump all the errors in.
Using phpinfo(); I see that /var/www/html/error_log is being used for error_log which is what I want. I set this up in /etc/php/7.0/apache2/php.ini already.
However, php errors are still being placed in /var/log/apache2/error.log
I tried restarting Apache using sudo service apache2 restart yet the issue persists.
Do you have any suggestions for how I can fix this? Let me know if you'd like more information.
PHP can be used and configured by two ways.
First of all the php.ini is taken and all those settings are used in CLI mode, so when you call a script from terminal or console.
Second way is a webserver, in your case apache. This uses either mod_php or php-fpm. Apache is controlled by custom config files which you will find in /etc/apache2/sites-enabled. Depending on how you configure your hostnames, ideally one file per virtual host, those settings will override that from the php.ini. One of commonly overritten values is log file and the access file.
Changing settings in a apache config require a service restart, because apache keeps them all in memory for performance.
I am developing php applications on Ubuntu 13.04 and when i am trying to change the upload_max_filesize setting:
$ sudo gedit /etc/php5/apache2/php.ini
and restart apache the values do not change in my phpinfo() they stay at the default values
This is the path mentioned in the phpinfo:
Loaded Configuration File /etc/php5/apache2/php.ini
Those values can be read from more than one location. You only show one location (and yes there is a phpinfo showing only one location but there are other elements in phpinfo hinting additional ini locations and to tell you the truth: the phpinfo does not show all inis).
So actually this depends on your configuration (which can greatly differ as you've got an open system) and the only thing we can say for sure is that you
a) edited the wrong file -or -
b) made a mistake while editing the right file.
To fix your issue, edit the right file.
To find the right file, learn about your systems PHP configuration.
To learn about your systems PHP configuration, start removing the ini and see what happens.
To learn about how it works in general - not specific to your system - you can easily consult the PHP manual:
Runtime Configuration Docs
Try to check if there is any syntax error in your php.ini, if there is any, it will not take the changes.
also make sure that your php.ini is writable
Or if you are on Linux (same will apply for windows, just different path), check the error log file with the command like this:
$ tail -n 100 /var/log/apache2/error.log
after restarting apache server
This will show you the line of the error and its cause in case of the syntax error in php.ini.
Check also "Scan this dir for additional .ini files" and "Additional .ini files parsed"
I cannot view PHP error on Apache of my mac because every time when I changed from php.ini file to display_error On. But when i restart and open the php.info file, it still says display_error Off. Searched for all php.ini file and changed all off to on but still same result. Help please
Use error_reporting(); at the begining of your PHP main file. It will ignore php.ini and obey the error level you set there.
Also, check that your php.ini is not beign use / locked before you make changes on it?
Though I have read lots of posts and pages concerning the issue (shown below), I guess I'm missing something here. The mais issue is: my PHP errors are not being logged to the file specified nor to the system event log.
My phpinfo() shows: Windows Server 2003, PHP 5.3.6, log_errors = On, error_log = C:\\errorphp.log
I have tried both error_log = C:\Inetpub\logs\php.log and error_log = syslog in php.ini to no effect (either one at a time).
I have:
restarted IIS after every php.ini change
granted the IUSR_XXXXX User Modify permissions on the folder AND the file
tried leaving the directory blank and letting PHP create the file
had a headache.
Any help is much appreciated.
references:
PHP Manual - PHP on IIS 6
Store PHP errors in a log file
IIS PHP doesn't log errors to log file
My php error log file is empty
Running a defect php file cause error 500
Logging PHP to Windows Event Log
In my case, setting
fastcgi.logging = 1
in php.ini solved the issue and I do have the log file working now (I left the file creation to php itself, my directory was blank)
I'd never guess that as the php.ini itself states (right above the stated config)
; Disable logging through FastCGI connection. PHP's default behavior is to enable this feature.
Go figure.
Have you
checked your error_reporting level
tried setting a log file inside the document root (incl. permission to write) to see if any restrictions apply?
I just set up phpMyAdmin3 with Nginx, and php-fcgi on PHP 5.3.8. Everything works perfectly when I rename php.ini to php.ini.disabled.
I get a generic error that says "Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly." when I run phpMyAdmin while php.ini is in tact.
When I run phpMyAdmin's index.php from the command line, it gives me the expected response: an html page saying "Wrong username/password. Access denied."
Can anyone point me in the right direction of where to look or what configuration option would probably be messed up in php.ini?
Have you made any changes to php.ini? Check your settings with a test php file with the following code
<?php phpinfo(); ?>
If nothing jumps out at you, try resetting the file. This php.ini might work.
If your really having trouble, consider reinstalling everything (assuming your not on a public server). A clean install of PHP and phpMyAdmin should fix any problems you may have.
You could try with disabling the APC settings in your php.ini and setting a valid session.save_path in your config. If phpMyAdmin it's usually because APC is enabled (and that's a problem combined with phpMyAdmin) or the sessions can't be saved locally.