How to fix Fatal error: Call to undefined function: mysql_connect() in Ubuntu
阿新 • • 發佈:2019-02-04
<!-- @page { margin: 0.79in } P { margin-bottom: 0.08in } -->
How to fix Fatal error: Call to undefined function: mysql_connect() in Ubuntu
When I use a PHP connection to test my web server, I get this error:
Fatal error: Call to undefined function: mysql_connect()
This is because php5-mysql is not installed. Here is the solution:
Step 1 Install php5-mysql
sudo apt-get install php5-mysql
Step 2 Reconfigure php5-mysql
sudo dpkg-reconfigure php5-mysql
Step 3 Restart mysqld
sudo /etc/init.d/mysql restart
After these 3 steps, I can connect to the database via my web server!
[Reference]:
http://www.go2linux.org/Fatal-error-Call-to-undefined-function-mysql_connect