httpd: could not open error log file /etc/httpd/logs/error_log

Hi, here i want to share how to troubleshoot for the above error in the redhat server.

When you trying to start the apache service, you have got below error:-

Starting httpd: [date]
(2)No such file or directory: httpd: could not open error log file /etc/httpd/logs/error_log.
Unable to open logs……………………..[FAILED]

  1. First of all,  re check the logs location that has been set in the conf file located by default at /etc/httpd/conf/httpd.conf

Please take note the clause of “ErrorLog logs/error_log”

and you found  ”    ServerRoot “/etc/httpd”      ”

so the full path will be  “/etc/httpd/logs/error_log” for the generated log.

2.  List out the content of “/etc/httpd/logs” by running following command and you will find no error logs in it, that’s why it could not find the file. If the files exists, please make sure the symlink which is point out to -> /var/log/httpd is not broken.

ls -ld /etc/httpd/logs

the output will be:-

lrwxrwxrwx 1 root root date /etc/httpd/logs -> ../../var/log/httpd

3. In the output above, the source directory for symbolic link /etc/httpd/logs is /var/log/httpd.

So, this kind of above mentioned error normally happen when the source file is missing and will be marked as red in color when you list out the content.

Create the error and access log file in the source directory by issuing below command:-

touch error_log access_log

4. Once the log file created, then you can start the apache service by using below command:-

/etc/init.d/httpd start

and verify it by using :-

/etc/init.d/httpd status

and you should get the below output:-

httpd (pid  xxxx) is running…

Thanks for viewing.

Timeout error occurred trying to start MySQL Daemon

Hi, have you been faced the above mentioned error when you trying to start the mysql service? Well here are some solutions that can be taken to resolve the issue.

Error:-

[[email protected]]# /etc/init.d/mysqld start
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL: [FAILED]

  1. Check the mysql log for the best practice of troubleshooting. Here is some example taken out from the mysql log:-

[[email protected]]# tail /var/log/mysqld.log

160824 12:47:11 mysqld ended

160824 12:49:36 mysqld started
160824 12:49:36 [Warning] option ‘max_join_size’: unsigned value 18446744073709551615 adjusted to 4294967295
160824 12:49:36 [Warning] option ‘max_join_size’: unsigned value 18446744073709551615 adjusted to 4294967295
160824 12:49:36 InnoDB: Started; log sequence number 0 43655
160824 12:49:36 [ERROR] /usr/libexec/mysqld: Can’t create/write to file ‘/var/run/mysqld/mysqld.pid’ (Errcode: 13)
160824 12:49:36 [ERROR] Can’t start server: can’t create PID file: Permission denied
160824 12:49:36 mysqld ended

2. Do the checking on ERROR in the above log which is:-

[ERROR] /usr/libexec/mysqld: Can’t create/write to file ‘/var/run/mysqld/mysqld.pid’

[ERROR] Can’t start server: can’t create PID file: Permission denied

3. It was clearly mention about the permission denied when it was trying to create the pid file on /var/run/mysqld/.  So, we can list out the permission for the directory of /var/run/mysqld by running the below command:-

ls -ld /var/run/mysqld

and you got below result:

drwx—–T 5 root root 4096 Aug 24 12:45 /var/run/mysqld

4. Change the directory permission to 755 so the system can create the pid file in that directory. The command will be:-

chmod 755 /var/run

5. Verify the permission by running again below command:-

ls -ld /var/run/mysqld

and you should be getting below result:-

drwxr-xr-x 2 mysql mysql 4096 Aug 24 12:59 /var/run/mysqld

6. Start the mysql service:-

[[email protected]]# /etc/init.d/mysqld start
Starting MySQL: [ OK ]
[[email protected]]# /etc/init.d/mysqld status
mysqld (pid 19633) is running…

and done, you are able to start the mysql service. Thanks for viewing!