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]
- 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:-
and verify it by using :-
and you should get the below output:-
httpd (pid xxxx) is running…
Thanks for viewing.