Finding Apache httpd.conf file location

It’s been quite sometime since i’ve used apache, I’ve been enjoying nginx so far but had to switch back to apache for a project. just a quick tip for those who are working with Apache. Sometimes we are forced to work with a server that we are unfamiliar of interms of configuration/settings/installation and asked where to find the Apache configuration file is on a given server. so I usually do:

$ ps -ef | grep apache

which will give me the list of process like this

[email protected]:/$ ps -ef | grep apache

apache 14305 22691 11 21:22 ? 00:00:00 /usr/local/httpd-2.2.4/bin/httpd -k start
apache 14341 22691 0 21:22 ? 00:00:00 /usr/local/httpd-2.2.4/bin/httpd -k start
apache 14374 22691 1 21:22 ? 00:00:00 /usr/local/httpd-2.2.4/bin/httpd -k start

or in other linux flavor / installation path

root 4053 1 0 02:34 ? 00:00:04 /usr/sbin/apache2 -k start
www 6789 14053 0 12:00 ? 00:00:00 /usr/sbin/apache2 -k start
www 6790 14053 0 12:00 ? 00:00:00 /usr/sbin/apache2 -k start

...

after seeing the list you can have a clue now ūüôā Then simply run


$ /usr/local/httpd-2.2.4/bin/httpd -V
or
$ /usr/sbin/apache2 -V

and then you will get the details you need…

Server compiled with....
-D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"

There you go. Do you have another faster method? Please do let me know.

phpMyAdmin can’t login

One of the common issue of phpMyAdmin  is getting the error on cookie or sometimes no matter how many times you login you keep getting redirected to login page.

Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly. Also ensure that cookies are enabled in your browser.

Screen Shot 2014-10-06 at 11.17.33 pm

At first i thought clearing the cookie will help solve the issue¬†but in my case, I previously had a ¬†apache webserver installed before i switched to nginx therefore the ownership of session folder was still under apache. All i had to do was to switch the folder ownership¬†to nginx, but please note the effect of this incase you are still using apache user. On the¬†command below i changed the ownership including the files inside the session folder because i know I’m not using apache user anymore. There are setup where by apache and nginx exists therefore both users are still valid and might be using¬†the session folder.

 

[[email protected] php]# pwd
/var/lib/php
[[email protected] php]# ls -l
total 8
drwxrwx— 2 root apache 4096 Oct¬† 5 15:54 session
drwxrwx— 2 root nginx¬† 4096 Sep 20 15:16 wsdlcache
[[email protected] php]# chown root.nginx session -R
[[email protected] php]# ls -l
total 8
drwxrwx— 2 root nginx 4096 Oct¬† 5 15:54 session
drwxrwx— 2 root nginx 4096 Sep 20 15:16 wsdlcache