I had php installed and running for awhile now but I am starting to work on a project in which to connect to a database (ie mysql) so i installed mysql (5.1.73) and now when I go to connect to the database using this line
$dbhandle = mysql_connect($hostname, $username, $password)
I get the following error:
1 Fatal error: Call to undefined function mysql_connect() in /var/www/file.php
This leads me to believe my configuration of php isn't connected to my recently installed version of mysql. I went to the config file (php.ini) that was listed in the phpinfo()
call and added in extension="php_mysql.dll" just because that was what most forums seems to recommend. After doing that I restarted (and reloaded the php.ini file I think) by using the service httpd restart
command.
Any recommendations?
If this is on centos do you have php-mysql package installed? By default php-mysql (the required files for mysql and mysqli) aren't installed with minimum installation.
yum install php-mysql
service httpd restart
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.