- 论坛徽章:
- 0
|
本帖最后由 imgotop 于 2010-05-02 09:55 编辑
我的CentOS装的是LNMP0.4这个一键安装包
但是用crontab运行php脚本的时候出现错误提示:
PHP Fatal error: Call to undefined function mysql_connect()
http://www.chinalinuxpub.com/bbs/archive/index.php/t-2221.html
这篇文章说是因为mysql库没有编译进去
所以我就运行 yum install php-mysql 命令
但是安装了这个之后出现错误
PHP Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
PHP Warning: mysql_query(): A link to the server could not be established in
运行yum install php-mysql的时候出现这个:- Running Transaction
- Installing : perl-DBI 1/4
- Installing : mysql 2/4
- warning: /etc/my.cnf created as /etc/my.cnf.rpmnew
- Installing : php-pdo 3/4
- Installing : php-mysql 4/4
复制代码 /etc/my.cnf.rpmnew的内容如下- [mysqld]
- datadir=/var/lib/mysql
- socket=/var/lib/mysql/mysql.sock
- user=mysql
- # Default to using old password format for compatibility with mysql 3.x
- # clients (those using the mysqlclient10 compatibility package).
- old_passwords=1
- # Disabling symbolic-links is recommended to prevent assorted security risks;
- # to do so, uncomment this line:
- # symbolic-links=0
- [mysqld_safe]
- log-error=/var/log/mysqld.log
- pid-file=/var/run/mysqld/mysqld.pid
复制代码 /etc/my.cnf 中关于socket的内容如下:- # The following options will be passed to all MySQL clients
- [client]
- #password = your_password
- port = 3306
- socket = /tmp/mysql.sock
- # Here follows entries for some specific programs
- # The MySQL server
- [mysqld]
- port = 3306
- socket = /tmp/mysql.sock
复制代码 查看/tmp/mysql.sock 是存在的
而对于/var/lib/mysql/mysql.sock 则根本没有/var/lib/mysql这个目录
运行service mysqld start命令,提示mysqld: unrecognized service
查看/etc/rc.d/init.d 目录,没有找到mysqld
我还利用ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock 命令建立了连接
但是都没有用 |
|