PDA

View Full Version : PHP can't access Mysql



mojiz
11-29-2007, 01:51 AM
Hi


I've tried to install Apache2.2 + PHP 5 + mysql 5.0 using Custombuild script.

Everything went fine except the php scripts cannot access the mysql server.
This is the error from phpmyadmin:


phpMyAdmin - Error

#2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)


But I can connect to the Mysql server using the mysql console.

The other problem is phpinfo() doesn't work! It gives timeout error in any script if used:
http://66.212.18.77/info.php

The OS is debian 4.


Thanks

What's wrong?

smtalk
11-29-2007, 01:56 AM
When I try to look at your PHP info - it lets me to download the file. Please post an output of:


cat /etc/httpd/conf/extra/httpd-php-handlers.conf
Did you restart apache after the changes? What's in your options.conf file?

mojiz
11-29-2007, 04:39 AM
The problem for the php cannot accessing mysql was localhost was not configured as 127.0.0.1 so I changed it in my php files. Now the mysql is instable so when I want to connect to mysql it goes offline.
the command


/etc/init.d/mysqld restart


always outputs:



Stopping mysqld: [ FAILED ]
Starting mysqld: [ OK ]

so the mysql crashes after starting

The error from phpmyadmin is:

#2013 - Lost connection to MySQL server at 'reading initial communication packet', system error: 111

mojiz
11-29-2007, 04:40 AM
Thanks for the answer.

When I try to look at your PHP info - it lets me to download the file. Please post an output of:


cat /etc/httpd/conf/extra/httpd-php-handlers.conf






AddHandler application/x-httpd-php .inc .php .php3 .php4 .php5 .phtml
AddHandler application/x-httpd-php-source .phps


Other PHP files work fine but wherever I use phpinfo() function I get timeout.

mojiz
11-29-2007, 04:45 AM
Did you restart apache after the changes? What's in your options.conf file?


# /etc/init.d/httpd restart
Stopping httpd:
Remaining processes: 26618
Stopping httpd:
Starting httpd: [Thu Nov 29 07:38:26 2007] [warn] module php5_module is already loaded, skipping
[Thu Nov 29 07:38:26 2007] [warn] module php5_module is already loaded, skipping


Yes I did restart it and this was the output(I restarted it again and got the exact same output)

options.conf:


#PHP settings. default_php possible values - 4 or 5
default_php=5
php4_cli=no
php4_cgi=no
php5_cli=yes
php5_cgi=no
zend=no

#Possible values - 5.0 or 5.1 (4.1 is possible too, but it's EOL)
mysql=5.0
mysql_inst=yes

#Possible values - 1.3, 2.0 or 2.2
apache_ver=2.2

#Web applications
phpmyadmin=yes
squirrelmail=yes
roundcube=yes
squirrelmail=yes
roundcube=yes

#Mail options
mail-header-patch=yes
dovecot=no
eximconf=no

#FTP options
proftpd=yes

#Custombuild options
clean=yes



btw I tried to install mysql 5.1 ( I needed a new feature ) but the script exited with 404 error from directadmin's fileserver.

mojiz
11-29-2007, 05:44 AM
Now I installed mysql-server from apt-get but is there any configurations I have to do to make it working with DA?