LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (http://www.linuxquestions.org/questions/linux-server-73/)
-   -   Apache 2.2.2/MySQL ??? Error (http://www.linuxquestions.org/questions/linux-server-73/apache-2-2-2-mysql-error-543818/)

mcupples 04-06-2007 11:03 AM

Apache 2.2.2/MySQL ??? Error
 
Okay, MySQL has not been working. I've posted this in one other thread, but since I'm having this apache weirdness as well I figured I'd group them into one question.

Here you can see MySQL just not working. Now that I've got more time I'll see if I can search Splunk for anything related. Any pointers on using Splunk or checking error logs would be greatly appreciated as well!
Code:

[root@69-64-69-24 ~]# httpd -v
Server version: Apache/2.2.2
Server built:  Jul 26 2006 11:12:08
[root@69-64-69-24 ~]# mysql -v
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@69-64-69-24 ~]# php -v
PHP 5.1.6 (cli) (built: Feb 23 2007 10:11:28)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
    with the ionCube PHP Loader v3.1.16, Copyright (c) 2002-2006, by ionCube Ltd.
[root@69-64-69-24 ~]#

This illustrates my directory structure.
Code:

[root@69-64-69-24 www]# pwd
/home/www
[root@69-64-69-24 www]# ls -lah
total 60K
drwxrwxrwx 4 root root 4.0K Apr  5 13:50 .
drwxrwxrwx 5 root root 4.0K Nov 29 10:40 ..
lrwxrwxrwx 1 root root  26 Mar 23 06:36 ckesler -> /home/ckesler/public_html/
drwxrwxrwx 2 root root 4.0K Nov 29 10:40 css
-rwxrwxrwx 1 root root  24 Mar 15 06:40 googlehostedservice.html
drwxrwxrwx 3 root root 4.0K Nov 29 10:40 img
-rwxrwxrwx 1 root root 3.5K Mar 13 14:28 index.html
-rw-r--r-- 1 root root  35K Apr  5 13:50 index.php
lrwxrwxrwx 1 root root  27 Apr  5 11:38 mcupples -> /home/mcupples/public_html/
lrwxrwxrwx 1 root root  27 Apr  5 11:38 mmongeau -> /home/mmongeau/public_html/

Now, the only problematic thing is that /home/www is not a real directory but a symlink itself. The real directory is /var/www/vhosts/default/htdocs. I don't think there's any issue with that, I just set it up that way so I didn't have to type all that out every time I go there.

I would post my httpd.conf file here but I'm afraid I'll get yelled at. Instead, I just hosted it at http://mcupples.com. It's the index page.

To recap:
* My issue with MySQL is the error "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)"
* My issue with Apache is that my settings are incorrect for supporting virtual hosts.

Thanks!

Edit: Also, how can I change the name of my server at the bash prompt? Instead of [root@69-64-69-24 www], I'd like it to say [root@mcupples.com www]. No worries about that, though!

zaichik 04-08-2007 09:11 AM

Keep in mind that when you type "mysql" at a prompt, you are trying to start the client. If there is no mysql.sock file, chances are that mysqld (the server) is not running. Depending on how it was installed, you should be able to type
Code:

/etc/init.d/mysql start
to get it running. Try that and let us know if that resolves the issue.

To change the hostname, type
Code:

hostname mcupples.com
and then edit /etc/sysconfig/network and make sure there is a line that has
Code:

HOSTNAME=mcupples.com
When you change the hostname, make sure that mysql is not running at the time. The reason is that it keeps track of its process ID in a file named <hostname>.pid, and if you change the hostname while it is running, it will look for <new hostname>.pid to shut down or restart.

See if that helps, and then we can address the Apache issue.

zaichik 04-09-2007 07:02 AM

httpd.conf looks fine. As long as you have the directories referenced by the virtual host containers, like /home/ckesler/public_html, there shouldn't be an issue. /home/www is a symlink, but the directories like the one above and /home/mcupples/public_html exist, correct? If so, I don't see what the issue is. What kind of error are you getting, and what does the Apache error log say about it?


All times are GMT -5. The time now is 08:52 PM.