'installing PHP mysql extension in RHEL

Mysql is not working with PHP (each of them OK individually, Mysql OK with perl).

I've added extension=mysql.so to php.ini

After searching on the internet, I've tried those two commands

yum install php php-mysql httpd
yum install php-mysql php-gd

However, this results in:

mysql-5.0.95-1.el5_7.1.i386 from rhel-i386-server-5 has depsolving problems
--> mysql conflicts with MySQL-server
Error: mysql conflicts with MySQL-server

Any suggestions ?



Solution 1:[1]

Install mysql-server and mysql-devel.

Solution 2:[2]

here's a small checklist>

  • have mysql service up and running.

service mysql status

service mysqld status
  • have installed php-mysql extension

yum install php-mysql

  • have your mysql.so or mysqli.so in the extensions folder, you can find this in phpinfo() in extensions dir, in my case>

extension_dir /usr/lib64/php/modules

  • check permissions for .so files I think -rwxr-xr-x. is a nice practice.

  • restart apache so it can reload php.ini

service httpd restart

then, you should be good to go.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 qitch
Solution 2 Josh Crozier