Today i stucked an error when i was trying to run a php script in a server eventhough my server was php5-mysql installed on it.At first i checked php, it was installed and working fine.Then checked mySQL.It was also working fine.I got the mysql prompt and the query was also working fine.I was experiencing.Tried the same solution when i experienced first.But this time it did’nt got worked.This time i had to use other solution and it got worked.The problem is actually php.ini file have enabled the mysql extension.
Solutions:
1)Remove php5-mysql with “apt-get remove php5-mysql” or “dpkg –purge remove php5-mysql and install it again or
2) Check your php.ini file to ensure it’s including the mysql.so library (extension=mysql.so) or
3)Type “dpkg-reconfigure php5-mysql” (For ubuntu and debian users)
will prompt 2 screens like this.

Select “yes” both and try again hope your problem will get resolved.
In my case it got resloved
