I have ran aptitude install php5-mysql
(and restarted MySQL/Apache 2), but I am still getting this error:
Fatal error: Call to undefined function mysql_connect() in /home/validate.php on line 21
phpinfo()
says the /etc/php5/apache2/conf.d/pdo_mysql.ini file has been parsed.
This error is encountered when we try to use “mysql_connect()” functions of php5 in php7. PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() error is raised because mysql_* functions are completely removed from PHP 7, it previously got deprecated in PHP 5.5, but now it is completely removed.
mysql_connect() establishes a connection to a MySQL server. The following defaults are assumed for missing optional parameters: server = 'localhost:3306', username = name of the user that owns the server process and password = empty password. The server parameter can also include a port number.
Call to undefined function error clearly shows that its not getting your function where you have defined. Reason is you are attaching full path of settings. php file with http . You need to include settings. php file without http path at the top of 'index.
This extension was deprecated in PHP 5.5. 0, and it was removed in PHP 7.0.
In case, you are using PHP7 already, the formerly deprecated functions mysql_*
were removed entirely, so you should update your code using the PDO-functions or mysqli_*
functions instead.
If that's not possible, as a workaround, I created a small PHP include file, that recreates the old mysql_*
functions with mysqli_*()
-functions: fix_mysql.inc.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With