Whilst loading a webpage, you get a server 500 error.
You examine the log file, and find something like:
[Wed Aug 08 13:28:27.449630 2018] [fcgid:warn] [pid 14926] [client xx.yy.31.18:51996] mod_fcgid: stderr: PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /dir/customer/public_html/xml.php:34
You are confused because this website used to work an everything is up to date.
You ask yourself what happened and you recall that you upgraded your PHP version.,
The fact of the matter is that the function mysql_connect has been completely removed in PHP 7.
As of PHP 5.5 mysql_connect has been deprecated as well but it will still work (but give warnings).
There are two courses of actions you can try here and a remote possible third.
- Downgrade the PHP version to 5.6 which is the last good 5.x release.
- Start converting your code from mysql_connect to mysqli_connect or PDO. PDO is the preferred option because of it’s object orientation but more complex because you have to store variables for your queries. mysqli could do the job with the least amount of change.
The third option is to find a compatibility library that will allow you to run mysql_connect on PHP 7. We don’t normally recommend this as there is a very good reason why mysql_connect has removed.
More information about this issue can be found here:
https://stackoverflow.com/questions/34088373/call-to-undefined-function-mysql-connect-after-upgrade-to-php-7
http://php.net/manual/en/function.mysql-connect.php
Please contact us if you need assistance with resolving this issue.