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). But then working fine through browser.
I followed these steps to install 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. Now with this installation upgraded to PHP 5.5.8. Also I tried adding
extension=mysql.so
into the php.ini file in following locations as well.
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini
Thanks in advance
php --inito find the loaded config file from the terminal.