-
-
Save lemesdaniel/00e437a7934e869d00da to your computer and use it in GitHub Desktop.
############################################################################## | |
# INSTALL isolated PHP 5.6 ZTS (Thread-safe) with pthreads on Ubuntu 14.04 ### | |
############################################################################## | |
1) Install necessary bison version | |
wget http://launchpadlibrarian.net/140087283/libbison-dev_2.7.1.dfsg-1_amd64.deb | |
wget http://launchpadlibrarian.net/140087282/bison_2.7.1.dfsg-1_amd64.deb | |
dpkg -i libbison-dev_2.7.1.dfsg-1_amd64.deb | |
dpkg -i bison_2.7.1.dfsg-1_amd64.deb | |
2) Download PHP | |
cd /usr/src | |
git clone https://github.com/php/php-src | |
cd php-src | |
2.a) Optionally check out speicific branch | |
git checkout PHP-5.6 | |
3) Download pthreads | |
cd ext | |
git clone https://github.com/krakjoe/pthreads | |
cd ../ | |
4) Compile | |
./buildconf --force | |
./configure --prefix=/opt/php-zts --with-config-file-path=/opt/php-zts/etc --enable-maintainer-zts --with-apxs2=/usr/bin/apxs --with-mysql --with-mysqli --enable-pthreads --enable-mbstring | |
make -j8 | |
make install | |
echo "extension=pthreads.so" > /opt/php-zts/modules.d/pthreads.ini | |
5) Symlinking | |
ln -s /opt/php-zts/bin/php /usr/local/bin/php-zts | |
ln -s /opt/php-zts/bin/phpize /usr/local/bin/phpize-zts | |
ln -s /opt/php-zts/bin/php-config /usr/local/bin/php-config-zts | |
ln -s /opt/php-zts/bin/php-cgi /usr/local/bin/php-cgi-zts | |
ln -s /opt/php-zts/bin/phpdbg /usr/local/bin/phpdbg-zts | |
################### | |
# BUILD MODULES ### | |
################### | |
cd /usr/src | |
git clone https://github.com/krakjoe/acpu | |
cd apcu | |
phpize-zts | |
./configure --with-php-config=php-config-zts | |
make -j8 | |
make install | |
echo "extension=apcu.so" > /opt/php-zts/modules.d/apcu.ini | |
-- http://stackoverflow.com/questions/18033191/how-to-install-pthread-in-ubuntu-12-10 |
Do not install 3rd party .deb's as they may contain rootkits and virus. Especially without https or checksums.
Hi. After I did the installation, the thread is successfully configured, but the localhost mysql driver stopped working.
Error: A Database connection using "Mysql" was missing or unable to connect. The database server returned this error: Selected driver is not enabled
Error: Mysql driver is NOT enabled
The interesting thing is that the localhost mysql connection works in the MySQL Workbench. Can you help me?
Thanks!
Hello.
I had a few issues with your commands:
- With the 5.6 version of php, the compilation failed because the "Zend/zend_inheritance.h" file was missing. I solved it by switching to the version 7.x.
- There is a typo: git clone https://github.com/krakjoe/apcu and not apcu.
Finally, the thread works properly.
I have a question though: how to tell apache to use this version of php? I suppose installing the package libapache2-mod-php5 won't work?
Edit: My bad, the procedure already binds this version of php. However, I have an other issue: Apache doesn't interprets php at all, and I have this error in CGI:
root@machine:/var/www/html# php-cgi-zts test.php
PHP Fatal error: The cgi-fcgi SAPI is not supported by pthreads in Unknown on line 0
PHP Fatal error: Unable to start pthreads module in Unknown on line 0
Hi. Thanks for this document. I have a server which has php5 installed. I need pthreads as a new library I will use in the project requires it. I want to replace the php5 currently installed in the server with a php that has pthreads enabled.
In your example, you install php to /opt/php-zts. How can I replace the current one installed on my server? Will just changing the prefix to /usr do the work?
which php
command returns /usr/bin/php in the server.Thanks in advance.