CentOS的PHP和MySQL配置 [英] CentOs Php and MySql Configuration
问题描述
我已经安装了PHP并运行一段时间,但现在我开始在其中一个项目连接到一个数据库(MySQL的就是),所以我mysql安装(73年5月1日),现在,当我去连接到使用该行的数据库
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 (i.e 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
这使我相信我的PHP配置没有连接到我最近安装的MySQL版本。我去的那是在的phpinfo()
通话上市,并在延长=激活php_mysql.dll补充说:仅仅因为这是大多数论坛的配置文件(php.ini中)似乎建议。这样做,我重新启动(并重新加载php.ini文件,我认为)使用服务的httpd重新启动
后命令。
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.
任何建议?
推荐答案
如果这是在CentOS你已经安装了PHP,MySQL的包?默认情况下PHP MySQL的(MySQL和mysqli的所需文件)没有安装最小的安装。
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的安装PHP,MySQL的
yum install php-mysql
服务的httpd重新启动
service httpd restart
这篇关于CentOS的PHP和MySQL配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!