Hello there -
I’m having a few issues I can’t seem to sort out - I was hoping someone could point me in the right direction. I’ve googled and searched these forums to no avail.
I have a droplet set up with a nice little LAMP stack, phpMyAdmin, Fail2Ban, etc. I added SSL today, and am currently running through the joys of doing that (which I won’t go into right now) - and found I needed Apache and PHP error logs. I had no problem setting up the directory/location of where to put the log files, and the apache logs seem to be working fine. However, the PHP log file I set up isn’t doing anything. I even purposely made PHP mistakes to test that the log was working, and it’s not. (I do see the PHP errors showing up in the apache log though - I’d rather keep them separated, if I can.)
I set up the PHP error log location in my php.ini file, and the phpinfo() test I have tells me that PHP is looking for the log where I placed it, however, nothing is getting written to the log file. So I’m wondering if I missed something along the line? (if it helps, I directed the log files to be placed in a /home/logs directory I created.)
And while I’m at it, I’d love to make the error logs just a bit more verbose. Is there any way to pull that off?
Thanks muchly :)
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
After spending the better part of the morning on this problem, here is what I learned…
If you want to put the error log file in a folder:
Note: Newer droplets will probably come with higher versions of PHP. So instead of “7.4” substitute “8.0” or whatever you’ve got.
The php.ini for PHP processes started by Apache is located at file /etc/php5/apache2/php.ini You can also change PHP setting in an .htaccess file in the VitualHost’s root directory using the syntax:
php_flag log_errors on
php_value error_reporting 32767
php_value error_log "/path/to/file"
The integer value 32767 corresponds to E_ALL (For more info on constants see here.)
For more info on the different log levels, check out: http://php.net/error-reporting
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.