Showing posts with label Linux apache. Show all posts
Showing posts with label Linux apache. Show all posts

Monday, June 17, 2013

Fixing httpd: [warn] module php5_module is already loaded, skipping

I have a CentOS webserver with the Apache and PHP installed on it and it works perfectly but when I restart the Apache service, I get this error:
[warn] module php5_module is already loaded, skipping



To solve this problem, I have to verify this module load call in two files and need to remove/comment from one of these file.

First, I need to check Apache main file:
sudo nano /etc/httpd/conf/httpd.conf



Yes, the module load call exist in this file:


Also check the php.conf file:
sudo nano /etc/httpd/conf.d/php.conf



Yes, module load call also exist here, so to fix this warning, we’ll comment/remove the module load call here:
#LoadModule php5_module modules/libphp5.so



Restart the httpd service:
sudo service httpd restart



This time, it didn’t display the warning!

Hope this will help you!

How to recover deleted Apache Log

Scenario: The server is running Apache and by mistake one of the log files gets deleted. How, we can recover it?

Currently, Apache server is working perfectly:



Login/Switch to as root user:



Move to the httpd in log directory:
cd /var/log/httpd



Delete the log file:
rm -f access_log



So the log file has been deleted,now find the process number for main apache procees that owned by root:
ps aux | grep httpd



In this case, the pid for the main apache process is 1784.

Now lets list the file descriptors:
ls -lsa /proc/1784/fd



Stop the apache service:
service httpd stop



Now copy the access log file that is marked as deleted (In this case it is 7) into the log directory:
cp /proc/1784/fd/7 /var/log/httpd/access_log



Start the apache service again:
service httpd start



Access the webpage again from your server:



Verify the log file:
tail -f /var/log/httpd/access_log



It’s working :-)

Hope this will help you!