我爱编程

php7 编译安装

2018-04-17  本文已影响0人  四夕皓月

PHP

安装 lib
apt-get install libmcrypt-dev libltdl-dev libxml2-dev libssl-dev libcurl4-openssl-dev
apt-get install libfreetype6-dev libpng12-dev libjpeg62-dev

配置、编译、安装
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-gd --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-png-dir=/usr --with-zlib=/usr --enable-mbstring --with-curl --with-openssl --with-mcrypt --enable-opcache --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --enable-mysqlnd

(这里是额外的参数 --enable-bcmath --enable-zip --enable-sockets --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd)
make
make install
(需要注意的是对 /usr/lib/x86_64-linux-gnu 的库文件软链到 /usr/lib 下)

复制配置
cp php.ini-production /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/default.conf

修改 /usr/local/php/etc/php-fpm.d/default.conf
listen = /var/run/php7-fpm.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0660

复制执行文件
ln -s /usr/local/php/bin/* /usr/bin
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
update-rc.d php-fpm defaults

启动/重启/关闭
service php-fpm {start|restart|stop}

Azalea

安装 lib
apt-get install autoconf

下载 azalea 和 azalea_sqlbuilder
git clone https://github.com/hdwong/azalea_sqlbuilder.git
git clone https://github.com/hdwong/php-azalea.git

配置、编译、安装
phpize
./configure --with-mysqlnd --with-sqlbuilder --with-service
make
make install

修改 /usr/local/php/etc/php.ini
extension_dir = "/扩展路径"
extension = azalea_sqlbuilder.so
extension = azalea.so
expose_php = Off
zend_extension = opcache.so
opcache.enable = 1

Cannot find OpenSSL's libraries when I try to install
sudo apt-get install -y autoconf g++ make openssl libssl-dev libcurl4-openssl-dev
sudo apt-get install -y libcurl4-openssl-dev pkg-config
sudo apt-get install -y libsasl2-dev

上一篇下一篇

猜你喜欢

热点阅读