博文記錄
PHP 2020-04-04 18:15:47 145 1

今天装了debian,记录一些在debian平台上编译安装PHP7的问题。

通过参考之前的CentOS安装方式,修改部分参数以及替换其对应的开发库依赖。

 

注意事项:

  1. 在centos上是***-devel的,在debian上是***-dev 这样子的。
  2. 关于lib库指向,centos是lib64,debian是lib

 

预先安装依赖

这些都是根据centos相关所需的库给转换过去的,如果以下没有完全包含你所缺少的开发库,则通过configure时报的具体错误,在google进行搜寻,找到具体的开发库并安装就好了。

需要注意的是,我们编译时常常所需的库均是开发库,**-dev 或者 **-devel 这样子的。不用安装程序。

拿缺少libzip举例:

apt install -y libzip

apt install -y libzip-dev

有的教程会告诉你两个全装了,其实大部分情况在编译时我们只需要后者而已。

apt-get install -y zlib1g-dev
apt-get install -y libjpeg-dev
apt-get install -y libpng-dev
apt-get install -y libwebp-dev
apt-get install -y autoconf g++ make openssl libssl-dev libcurl4-openssl-dev
apt-get install -y libcurl4-openssl-dev pkg-config
apt-get install -y libsasl2-dev
apt-get install -y libzip-dev

apt-get install -y libldb-dev libldap2-dev
ln -s /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/libldap.so \
&& ln -s /usr/lib/x86_64-linux-gnu/liblber.so /usr/lib/liblber.so

 

php7.4特有的依赖,如果是PHP7.4你需要下面这些。

apt install -y libsqlite3-dev
apt install -y libonig-dev

 

完整配置

关于参数变更详参:

https://www.php.net/manual/en/migration74.other-changes.php#migration74.other-changes.pkg-config

PHP7.4

wget http://php.net/get/php-7.4.4.tar.gz/from/this/mirror -O php-7.4.4.tar.gz
tar -xzf php-7.4.4.tar.gz -C ./
cd php-7.4.4
./configure --prefix=/usr/local/php/php7.4.4/\
 --with-config-file-path=/usr/local/php/php7.4.4/\
 --with-libdir=lib\
 --enable-fpm\
 --enable-gd\
 --enable-gd-jis-conv\
 --with-fpm-user=www\
 --with-fpm-group=www\
 --enable-mysqlnd\
 --with-pdo-mysql=mysqlnd\
 --enable-opcache\
 --enable-pcntl\
 --enable-mbstring\
 --enable-soap\
 --enable-calendar\
 --enable-bcmath\
 --enable-exif\
 --enable-ftp\
 --enable-intl\
 --enable-sockets\
 --with-openssl\
 --with-zlib\
 --with-curl\
 --with-gettext\
 --with-mhash\
 --with-webp\
 --with-jpeg\
 --with-ldap\
 --with-zip

 

进行编译

make && make install 

复制配置文件

cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
cp php.ini-production  /usr/local/php/php7.4.4/php.ini
cp /usr/local/php/php7.4.4/etc/php-fpm.conf.default /usr/local/php/php7.4.4/etc/php-fpm.conf
cp /usr/local/php/php7.4.4/etc/php-fpm.d/www.conf.default /usr/local/php/php7.4.4/etc/php-fpm.d/www.conf

 

写入执行权限

chmod +x /etc/init.d/php-fpm

重载系统服务,否则无法使用systemctl进行管理

systemctl daemon-reload

启动php-fpm

systemctl start php-fpm

停止php-fpm

systemctl stop php-fpm

增加到开启自启

systemctl enable php-fpm

 

Enjoy ~

 

brand cialis online

2020-05-09 07:49

I was curious if you ever considered changing the layout of your website? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having one or two images. Maybe you could space it out better?

發表評論
StudioEIM - 冒险者讲习所
0:00