简体   繁体   English

CentOs Php和MySql配置

[英]CentOs Php and MySql Configuration

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 我已经安装了php并运行了一段时间,但是我开始在一个要连接到数据库(例如mysql)的项目上工作,所以我安装了mysql(5.1.73),现在当我使用此连接到数据库时线

$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. 这使我相信我的php配置未连接到我最近安装的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. 我去了phpinfo()调用中列出的配置文件(php.ini),并在extension =“ php_mysql.dll”中添加了它,原因就是大多数论坛似乎都建议这样做。 After doing that I restarted (and reloaded the php.ini file I think) by using the service httpd restart command. 之后,我使用service httpd restart命令重新启动(并重新加载了我认为的php.ini文件)。

Any recommendations? 有什么建议吗?

If this is on centos do you have php-mysql package installed? 如果在centos上安装了php-mysql软件包? By default php-mysql (the required files for mysql and mysqli) aren't installed with minimum installation. 默认情况下,最低安装时未安装php-mysql(mysql和mysqli所需的文件)。

yum install php-mysql 百胜安装php-mysql

service httpd restart 服务httpd重新启动

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM