My PHP script gives the error 'Call to undefined function: mysql_connect()'

Knowledge Base

My PHP script gives the error 'Call to undefined function: mysql_connect()'

Normally we find that this error is caused by unecessary or incorrect directives in a custom 'php.ini' file. 

We usually find this happens when the extension_dir directive is specified within a custom 'php.ini' file - if you are getting this error and you have a custom 'php.ini' that has the extension_dir directive in it then please remove this line which should resolve the problem. 

Using a 'php.ini' found on other webservers or examples given on PHP-related websites will likely cause problems such as this. If this does not resolve the issue, you should contact whoever supplied the script that you are attempting to run as this may suggest a coding issue.