linux 删除编译的php,linux上编译php

1、安装依赖包

yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp gmp-devel expat-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel libcurl libcurl-devel curl curl-devel libmcrypt libmcrypt-devel libxslt libxslt-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmemcached-devel libzip readline readline-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers

2、下载php并解压

wget  https://www.php.net/distributions/php-7.4.1.tar.gz

tar -zvxf  php-7.4.1.tar.gz

cd php-7.4.1/

3、编译

./configure --enable-inline-optimization --enable-debug--disable-rpath --enable-shared--enable-cgi--enable-sockets --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-bz2  --enable-soap  --with-openssl  --with-openssl-dir --with-curl --enable-mbstring --with-zlib --with-zlib-dir   --enable-opcache  --with-gd --enable-gd-jis-conv  --with-gettext --with-pcre-dir  --with-pcre-regex  --with-pcre-dir  --with-png-dir  --with-freetype-dir  --enable-calendar --enable-ftp --with-xml  --with-xmlrpc  --with-mhash  --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-readline --with-iconv --enable-pcntl --enable-zip --with-pear --enable-bcmath   --enable-ctype --enable-tokenizer --with-libxml --with-libxml-dir

执行./configure出现的问题(部分)

##########

问题1:

a8e8c20e2dfc

问题1

方法:安装sqlite-devel

问题2:能安装oniguruma,却没法安装oniguruma-devel

a8e8c20e2dfc

问题2

方法:重新安装oniguruma,具体方法见" 附 "

问题3:configure: error: Please reinstall readline - I cannot find readline.h

方法:yum install -y  readline-devel

#############

make && make install

php -v

4、设置php

cp php.ini-production /usr/local/lib/php.ini

注:php --ini默认哪个目录就放哪个目录,不然扩展加到php.ini没效果

cp /usr/local/etc/php-fpm.d/www.conf.default  /usr/local/etc/php-fpm.d/www.conf

cp /usr/local/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf

5、设置/etc/init.d/php-fpm启动

cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm

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

chkconfig --add php-fpm

chkconfig php-fpm on

service php-fpm start

6、设置systemctl启动

vi /usr/lib/systemd/system/php-fpm.service[Unit]

Description=The PHP FastCGI Process Manager

After=syslog.target network.target

[Service]

Type=forking

PIDFile=/var/run/php-fpm.pid

ExecStart=/usr/local/sbin/php-fpm

ExecReload=/bin/kill -USR2 $MAINPID

PrivateTmp=true

[Install]

WantedBy=multi-user.target

同时开启php-fpm.conf中的pid=/var/run/php-fpm.pid

systemctl enable php-fpm (设置开机自启)注意:将/usr/local/etc/php-fpm.conf的最后一行include=NONE/etc/php-fpm.d/*.conf的NONE去掉,改成 include=/usr/local/etc/php-fpm.d/*.conf的

附:1、下载并解压

wget https://github.com/kkos/oniguruma/archive/v6.9.4.tar.gz -O oniguruma-6.9.4.tar.gztar -zxf oniguruma-6.9.4.tar.gzcd oniguruma-6.9.4

2、编译

./autogen.sh && ./configure --prefix=/usr

make && make install

a8e8c20e2dfc

安装oniguruma出现的问题

注意:编译onigurum的过程中需安装automake和libtool

参考地址:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值