0

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

2
  • I think your question would be more relevant, and receive more help, over at Server Fault. Stack Overflow mostly deals with programming question and less so about server setups. Commented Sep 20, 2014 at 6:45
  • Note: You could use php --ini to find the loaded config file from the terminal. Commented Sep 20, 2014 at 7:37

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

Mysql error is fixed and started getting new one "PHP Fatal error: Call to undefined function curl_init()" while checking phpinfo(), cURL support is enabled. Still not getting. Any idea?
--with-curl should do it, remember to make clean between builds ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.