[英]undefined function mysql_connect() from terminal
I have recently installed pthreads in my machine(ubuntu 12.04 LTS 32bit) and thereafter mysql_connect() is not working from terminal(via CRON JOB as well). 我最近在我的机器上安装了pthreads (ubuntu 12.04 LTS 32bit),此后mysql_connect()无法从终端运行(也通过CRON JOB)。 But then working fine through browser.
但随后可以通过浏览器正常工作。
I followed these steps to install pthreads 我按照以下步骤安装了pthreads
# Required libraries
sudo apt-get install gcc make libzzip-dev libreadline-dev libxml2-dev \
libssl-dev libmcrypt-dev libcurl4-openssl-dev lib32bz2-dev
# Download PHP
cd /usr/local/src
wget http://www.php.net/distributions/php-<version>.tar.gz
( e.g. wget http://www.php.net/distributions/php-5.5.8.tar.gz )
# Extract
tar zxvf php-<version>.tar.gz
(e.g. tar zxvf php-5.5.8.tar.gz )
# Configure
cd /usr/local/src/php-<version>
( e.g. cd /usr/local/src/php-5.5.8 )
./configure --prefix=/usr --with-config-file-path=/etc --enable-maintainer-zts
# Compile
make && make install
( make -j3 && make -j3 install) -> Faster building
# Copy configuration
cp php.ini-development /etc/php.ini
# Install pthreads
pecl install pthreads
echo "extension=pthreads.so" >> /etc/php.ini
# Check installation
php -m | grep pthreads
Note : Previously I was using PHP 5.3.10. 注意 :以前我使用的是PHP 5.3.10。 Now with this installation upgraded to PHP 5.5.8.
现在,此安装已升级到PHP 5.5.8。 Also I tried adding
我也尝试添加
extension=mysql.so
into the php.ini file in following locations as well. 以及以下位置的php.ini文件。
/etc/php5/apache2/php.ini
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini
/etc/php5/cli/php.ini
Thanks in advance 提前致谢
Should read more like: 应该阅读更多像:
./configure --prefix=/usr \
--with-config-file-path=/etc \
--enable-maintainer-zts \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd
See: 看到:
./configure --help
For options. 有关选项。
Note that mysql is deprecated, use mysqli or pdo-mysql instead 请注意,不建议使用mysql,请改用mysqli或pdo-mysql
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.