PHP5 will not connect to mysql

Support for webhosts that use CentOS
Post Reply
castrike
Posts: 2
Joined: 2007/09/16 19:12:02

PHP5 will not connect to mysql

Post by castrike » 2007/09/16 19:32:00

I have installed PHP 5.1.6, mysql 4.1.20 on my centos server. Running apache 2.x.
When im in the server i can access mysql, create databases, create tables, edit them and do anything i want pretty much.
Same with PHP, i can declare functions, variables and everything and i will get the result expected, but
whenever i call the function mysql_connect(); nothing after that statement gets executed. I changed some default values in php.ini, tried restarting mysql, tried using the 'default' php.ini file.

Asked some friends and everything seems alright.

:-(

castrike
Posts: 2
Joined: 2007/09/16 19:12:02

Re: PHP5 will not connect to mysql

Post by castrike » 2007/09/17 02:21:24

i think i got it. when i run phpinfo, mysql is not there... i just gotta link em or something and im googling around not finding anything
pls help.

azca
Posts: 174
Joined: 2006/06/03 18:06:13
Location: Peoria, AZ USA

PHP5 will not connect to mysql

Post by azca » 2007/09/17 04:49:10

Do you have 'php-mysql' installed? I am assuming that you installed PHP 5.1.6 from the centosplus repo (?)

If that is the case, then try this:

# yum --enablerepo=centosplus list php-mysql

And if it is installed you would see something like this:

Installed Packages
php-mysql.i386 5.1.6-3.el4s1.7 installed

If not installed, then try this:

# yum --enablerepo=centosplus install php-mysql

BE AWARE that doing this will upgrade MySQL from 4.1 to 5.0 as you can see:

# yum --enablerepo=centosplus deplist php-mysql
.
.
package: php-mysql.i386 5.1.6-3.el4s1.7
.
.
dependency: libmysqlclient.so.15(libmysqlclient_15)
provider: mysql.i386 5.0.22-1.centos.1
provider: mysql.i386 5.0.27-1.el4.centos
provider: mysql-libs.i386 5.0.42-1.el4.centos
provider: mysql-libs.i386 5.0.44-1.el4.centos
provider: mysql-libs.i386 5.0.46-1.el4.centos
.
.

So plan ahead for that.

Also, I was prompted (forgot by what) to run:

# mysql_fix_privilege_tables --password=********

To do whatever MySQL needed to do with the passwords.

Post Reply

Return to “CentOS 4 - Webhosting Support”