Last active
June 13, 2018 21:13
-
-
Save nguyentienlong/120af89ab11e5ec48014 to your computer and use it in GitHub Desktop.
install php7 with php-fpm on custom installation directory
This file contains 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
# change directory to /opt | |
cd /opt | |
# tar source file | |
tar zxf php-7.0.3.tar.gz | |
# go to src dir | |
cd php-7.0.3 | |
# build make file | |
# install php7 in /opt/php7 and specify the config file (php.ini) in /etc/php7 | |
./configure --prefix=/opt/php7 \ | |
--with-config-file-path=/etc/php7 \ | |
--with-pdo-pgsql \ | |
--with-zlib-dir \ | |
--with-freetype-dir \ | |
--enable-mbstring \ | |
--with-libxml-dir=/usr \ | |
--enable-soap \ | |
--enable-calendar \ | |
--with-curl \ | |
--with-mcrypt \ | |
--with-zlib \ | |
--with-gd \ | |
--with-pgsql \ | |
--disable-rpath \ | |
--enable-inline-optimization \ | |
--with-bz2 \ | |
--with-zlib \ | |
--enable-sockets \ | |
--enable-sysvsem \ | |
--enable-sysvshm \ | |
--enable-pcntl \ | |
--enable-mbregex \ | |
--enable-exif \ | |
--enable-bcmath \ | |
--with-mhash \ | |
--enable-zip \ | |
--with-pcre-regex \ | |
--with-pdo-mysql \ | |
--with-mysqli \ | |
--with-mysql-sock=/var/run/mysqld/mysqld.sock \ | |
--with-jpeg-dir=/usr \ | |
--with-png-dir=/usr \ | |
--enable-gd-native-ttf \ | |
--with-openssl \ | |
--with-fpm-user=nginx \ | |
--with-fpm-group=nginx \ | |
--with-libdir=/lib/x86_64-linux-gnu \ | |
--enable-ftp \ | |
--with-gettext \ | |
--with-xmlrpc \ | |
--with-xsl \ | |
--enable-opcache \ | |
--enable-fpm | |
# build program | |
make | |
# run the php test if you want | |
make test | |
# install php7 | |
sudo make install | |
# copy php.ini-development to /us | |
sudo cp php.ini-development /etc/php7/php.ini | |
To run php cli every where | |
# copy /opt/php7/bin/php to /usr/local/bin | |
sudo cp /opt/php7/bin/php /usr/local/bin/php | |
# or add /opt/php7/bin to $PATH | |
export PATH=/opt/php7/bin:$PATH | |
To start php-fpm with specify config file | |
sudo /opt/php7/sbin/php-fpm --fpm-config /opt/php7/etc/php-fpm.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment