-1

I upgraded the php on my server. Now when I attempt to connect to the mysql server via php I get the following:

Fatal error: Call to undefined function mysql_connect() 

So I ran

sudo yum install php-mysql

This is what I got:

--> Running transaction check
---> Package php-mysql.x86_64 0:5.3.3-40.el6_6 will be installed
 --> Processing Dependency: php-common(x86-64) = 5.3.3-40.el6_6 for package: php-mysql-5.3.3-40.el6_6.x86_64
--> Processing Dependency: php-pdo(x86-64) for package: php-mysql-5.3.3-40.el6_6.x86_64
--> Running transaction check
---> Package php-common.x86_64 0:5.3.3-40.el6_6 will be installed
---> Package php-pdo.x86_64 0:5.3.3-40.el6_6 will be installed
--> Processing Conflict: php56w-common-5.6.17-1.w6.x86_64 conflicts php-common < 5.5.0
--> Finished Dependency Resolution
Error: php56w-common conflicts with php-common-5.3.3-40.el6_6.x86_64
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest

Is there a simple solution to this?

user1011332
  • 773
  • 12
  • 27

2 Answers2

0

Create a php.ini File On public_html and Type extension=php_mysql.dll;

and Save

Rajesh J Nair
  • 179
  • 10
0

Taken from PHP : Undefined function mysql_connect()

mysql_connect()

has been removed from PHP7, which is used by the newest php version.

Instead, use mysqli_connect() like in this example.

Another method, PDO is also possible (but is coded in a very different way as mysql_connect.)

Community
  • 1
  • 1
davejal
  • 6,009
  • 10
  • 39
  • 82