Last active
February 1, 2020 06:20
-
-
Save ajcastro/6a8f0880c786c3f2189d81beb4760a84 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Instructions. Copy and paste the codes below: | |
cd /usr/local/src | |
# Download all needed archives, four(4) archives | |
# For PHP source | |
wget http://au1.php.net/get/php-5.6.21.tar.bz2/from/this/mirror -O php.tar.gz | |
# For curl. You can choose from any mirror site from https://curl.haxx.se/latest.cgi?curl=tar.gz&all=yes | |
wget https://dl.uxnr.de/mirror/curl/curl-7.48.0.tar.gz | |
# For libxml2 | |
wget ftp://xmlsoft.org/libxml2/libxml2-2.8.0.tar.gz | |
# For libmcrypt | |
wget http://ncu.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz | |
# Extract all archives | |
sudo tar xzvf php.tar.gz | |
sudo tar xzvf curl-7.48.0.tar.gz | |
sudo tar xzvf libxml2-2.8.0.tar.gz | |
sudo tar xzvf libmcrypt-2.5.8.tar.gz | |
# Install all dependencies | |
# Install curl | |
cd curl-7.48.0 | |
sudo ./configure | |
sudo make | |
sudo make install | |
cd .. | |
# Install libxml2 | |
cd libxml2-2.8.0 | |
sudo ./configure | |
sudo make | |
sudo make install | |
cd .. | |
# Install libmcrypt | |
cd libmcrypt-2.5.8/ | |
sudo ./configure --disable-posix-threads | |
sudo make | |
sudo make install | |
cd .. | |
# Now all dependencies are installed, it is ready to build our custom-built php | |
cd /usr/local/src/php-5.6.21 | |
sudo ./buildconf --force | |
sudo ./configure \ | |
--prefix=/usr/local/src/php-5.6.21 \ | |
--with-libdir=/lib/x86_64-linux-gnu/ \ | |
--with-openssl=/usr --with-curl=/usr \ | |
--disable-cgi \ | |
--with-config-file-path=/usr/local/src/php-5.6.21/etc \ | |
--enable-gd-native-ttf --enable-mysqlnd \ | |
--enable-opcache --enable-pcntl \ | |
--enable-debug --enable-maintainer-zts \ | |
--enable-mbstring \ | |
--enable-bcmath --enable-exif \ | |
--enable-ftp --enable-shmop \ | |
--enable-soap --enable-sockets \ | |
--enable-sysvmsg --enable-sysvsem \ | |
--enable-sysvshm --enable-wddx \ | |
--enable-opcache --enable-zip --enable-dba \ | |
--with-mcrypt --with-mysqli --with-pdo-mysql | |
sudo make clean | |
sudo make # Or use `make -j` to for faster processing because it uses multiple jobs | |
sudo make install | |
# Set and copy php.ini | |
sudo mkdir etc | |
sudo cp php.ini-production etc/php.ini | |
# Create symlink for our custom-built php. You can replace 'phpzts' symlink name to 'php' or any if you prefer | |
sudo ln -s /usr/local/src/php-5.6.21/sapi/cli/php /usr/bin/phpzts | |
# Install pthreads using pear | |
sudo bin/pear install pecl.php.net/pthreads-2.0.10 | |
# This sets important configuration in your php.ini for extension_dir and pthreads | |
echo 'extension_dir = "/usr/local/src/php-5.6.21/lib/php/extensions/debug-zts-20131226"' | sudo tee -a etc/php.ini | |
echo 'extension=pthreads.so' | sudo tee -a etc/php.ini | |
# Check if pthreads and mcrypt is installed, 'pthreads' and 'mcrypt' should be in the list | |
phpzts -m | |
# If error occured "PDOException SQLSTATE[HY000] [2002] No such file or directory": | |
# Please refer to http://stackoverflow.com/questions/20723803/pdoexception-sqlstatehy000-2002-no-such-file-or-directory | |
# Make sure to set the correct unix_socket in your database.php config |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment