How To Stop Apache PHP WordPress Error Logs

Recently I faced a problem of automatic generation of  Apache/PHP/WordPress error logs of huge size in my VPS. By default the error log is turned on in Apache but sometimes it’s a problem if you are running shortage of disk space and also it puts load on your server. After a thorough investigation with the present error logs, I decided to turn off the Apache/PHP/WordPress error logs experimentally for few days.

Here I am writing the steps what you need to do if you face similar kind of problem. But before doing anything, check your WordPress plugin. Bad plugins sometimes cause heavy errors. You need to deactivate them first. Also error logs are important to analyse any problem in site. So decide to stop only if you need it or to experiment with it. You can check error logs from cPanel or by downloading via FTP/SFTP and opening it to any text editor.

1) Login to your WHM. First check your Main >> Server Configuration >> Tweak Settings >> Stats & Logs
There you’ll get the default values like the following image. Keep it as below.

tweak server stats logs WHM How To Stop Apache PHP Wordpress Error Logs

2. Now connect to your SFTP as root (By Filezilla or CuteFTP or SmartFTP). Go to /usr/local/apache/conf and download the httpd.conf file there. Keep another copy by ‘save as’ and rename it for back up. Now open the httpd.conf file in an editor like editplus and find the following code.

ErrorLog logs/error_log

Now change the code by commenting as below:

#ErrorLog logs/error_log

3. Now check if there is already any error log (error_log)or not in /usr/local/apache/logs/. If you find the error log, download it and open it in text editor to analyse the type of error.

4. If you see some sort of zend module error or ioncube error in that log, you can be sure that your existing Apache build has some problem with PHP. The error can be different but that you need to analyse specifically seeing the problem.

5.  If you decide to rebuild your Apache, login again to WHM. Main >> Software >> EasyApache (Apache Update). Start from previously saved configuration or if your last configuration failed, then start with basic.
Then in step by step manner build it as what you need. I would recommend not to check every option there. Select only what you need. Also my recommendation is if you want to speed up your server, then go either for eAccelerator or Zend Optimiser, not with both. After your Apache is freshly built, repeat the step 2.

6. Now upload the altered httpd.conf to your server /usr/local/apache/conf

7. Now restart httpd. Connect to your putty (SSH command line login)and write this command there
# service httpd restart. Else you can restart Apache from WHM

8. Now check if in your public_html, if there is any existing error log. Download it and open to analyse. If you see something like “unable to load dynamic library …unable to open….no such file/directory
/usr/local/lib/php/extensions/no-debug-non-zts-20060613/pdo.so
/usr/local/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so
/usr/local/lib/php/extensions/no-debug-non-zts-20060613/pdo_sqlite.so
/usr/local/lib/php/extensions/no-debug-non-zts-20060613/sqlite.so
/usr/local/lib/php/extensions/no-debug-non-zts-20060613/homeloader.so”

Then there are some problem in your instances of php.ini file.

9. Check your phpinfo().  How to check your phpinfo.php? You can put the following code opening notepad and save it as phpinfo.php

<?php phpinfo();?>

or just with

<? phpinfo(); ?>

Then upload it to your public_html directory and call it on browser as http://www.your-domain.com/phpinfo.php

10. Now check in your phpinfo.php, “Configuration File (php.ini) Path” (Something like /usr/local/lib) and “Loaded Configuration File” (Something like ../public_html/php.ini). So these are your two instances of php.ini files.

11. Now login to your root via SFTP and download those two php.ini instances. Take backup. Analyse minutely. The php.ini stored into /usr/local/lib [Configuration File (php.ini) Path] is your latest php.ini after Apache rebuilt. So replace this file with “Loaded Configuration File” i.e. in ../public_html/php.ini so that both the php.ini instances point to same. Check first, you need to place the latest php.ini in both places i.e. in /usr/local/lib/php.ini & in ../public_html/php.ini

12. Now login via SFTP and go to your /tmp . Downlod the full folder to keep backup for safety. Then clear only all the session files (similar to sess_2e04c3e9869e3c29794dbcacca787107 etc) there.

That’s it.  I followed the above steps for my type of problem. The php/Apache errors have also reduced drastically and no heavy error logs now. If you have faced any other similar problem and got a solution in a different way, feel free to share with me by commenting below.

Users who found this post were searching for:

huge php error log size

Related posts:

  1. 12 Quick tweaks for VPS/WHM/cPanel to speed up WordPress
  2. How to install WordPress manually – Quick steps
  3. 5 Best WordPress Forum Plugins for Easy WordPress Forum Installation
About Debajyoti

Debajyoti Banerjee is the Founder and CEO of Seven Boats Info-System Pvt. Ltd. - A full service digital marketing company in India. Debajyoti is an experienced SEO expert and Internet Marketing consultant from Kolkata, India. As a web entrepreneur and online marketing strategist, he is helping many companies to transform their businesses to the next level of success by 1) making their websites convenient, interactive and immediate; 2) helping them to reduce cost and increase efficiency; 3) making their websites more flexible and 4) helping them to get more global customers.

Comments

  1. joseph Mrcy says:

    nice tips, man. I’ll use ur tips for my blogs http://www.infoheaps.com, http://www.gadgetsatz.com
    thanks

Speak Your Mind

*

CommentLuv badge