You are not logged in.

#1 2012-01-13 05:35:13

stefano
Member
Registered: 2011-04-09
Posts: 258

[SOLVED] Setting up LAMP results in "Could not connect" messages

I am trying to set up a LAMP stack on my desktop, mostly for development purposes. I followed the instruction in the LAMP page in the wiki to the letter: checked that the http user existed, fixed the http.conf and rc.conf files, started the http server. When I try to connect to localhost, however, instead of the usual Apache page I get a " "Could not connect" message. I tried to connect to localhost, to 127.0.0.1, to the local IP address om my box (i.e the 192.168...), and to my actual (non-DNS registered) hostname. To no avail.

The error log has some info that may be relevant. When the httpd  starts I find the following error lines in the log (I'm skipping warning and notices):

[Thu Jan 12 23:20:23 2012] [error] (2)No such file or directory: Couldn't bind unix domain socket /var/run/httpd/cgisock.3645
[Thu Jan 12 23:20:23 2012] [error] (2)No such file or directory: could not create /var/run/httpd/httpd.pid
[Thu Jan 12 23:20:23 2012] [error] httpd: could not log pid to file /var/run/httpd/httpd.pid

I am assuming these two errors are what is causing the problem. But I have no idea how to solve them. The /var/run/httpd dir does not exist on my system, and I have no idea what's supposed to be in it, to tell the truth. I do have, however, a /etc/httpd/run directory.

Does anyone know how to go about solving this problem?

Cheers,

Stefano

Last edited by stefano (2012-01-13 15:25:47)

Offline

#2 2012-01-13 08:09:33

KingX
Member
From: CA
Registered: 2010-03-24
Posts: 324

Re: [SOLVED] Setting up LAMP results in "Could not connect" messages

As root create the directory /var/run/httpd then do

touch /var/run/httpd/httpd.pid

After do this

chown -R http:http /var/run/httpd

Then try starting the daemon and see if it works.

Edit: Creating the pid file might not be necessary... so you can leave the "touch" part out. Just create the directory and change its owner/group to http.

Last edited by KingX (2012-01-13 08:11:05)

Offline

#3 2012-01-13 15:25:07

stefano
Member
Registered: 2011-04-09
Posts: 258

Re: [SOLVED] Setting up LAMP results in "Could not connect" messages

Thanks, that worked.

To be precise:

creating the /var/run/httpd directory and changing owner/group solved the problem.

The /var/run/httpd/httpd.pid file was not needed and indeed prevented httpd from running:

$ sudo /etc/rc.d/httpd restart
:: Restarting Apache Web Server
(20014)Internal error: Error retrieving pid file /var/run/httpd/httpd.pid
Remove it before continuing if it is corrupted.

After I removed the file, httpd started normally.

One question though: is this a bug in the LAMP package installation procedure? Or is /var/run/httpd a standard directory that should have been present in my system and I (or some program) may have accidentally erased?

Cheers,

Stefano

Offline

#4 2012-01-13 19:26:05

KingX
Member
From: CA
Registered: 2010-03-24
Posts: 324

Re: [SOLVED] Setting up LAMP results in "Could not connect" messages

Not sure, the couple of times I have installed apache it created the directory for me just fine. You can try re-producing the bug by reinstalling and see if the directory is again not created. It's not a standard directory, I don't have apache on my machine right now and nor do I have /var/run/httpd/.

Offline

Board footer

Powered by FluxBB