PHP7.3源码编译(下面的配置 --enable 添加的模块比较少 是针对swoole) swoole不需要php-fpm 下面说的php-fpm 开启可以忽略
wget https://www.php.net/distributions/php-7.3.16.tar.gz PHP7.3编译自带 pdo和 mysqlnd
tar -zxvf php-7.3.16.tar.gz
cd php-7.3.16
./configure --prefix=/usr/local/php7.3 --with-config-file-path=/usr/local/php7.3/etc --with-iconv=/usr/local/libiconv --enable-fpm --with-mysqli --with-openssl
ps :
libiconv这个必须要指定 不然安装不了
没有安装
libiconv可以安装下
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz tar -zxvf libiconv-1.13.1.tar.gz cd libiconv-1.13.1 ./configure --prefix=/usr/local/libiconv make make install
然后PHP继续
make
makeinstall
php安装成功如下
Installing shared extensions: /usr/local/php7.3/lib/php/extensions/no-debug-non-zts-20180731/ Installing PHP CLI binary: /usr/local/php7.3/bin/ Installing PHP CLI man page: /usr/local/php7.3/php/man/man1/ Installing phpdbg binary: /usr/local/php7.3/bin/ Installing phpdbg man page: /usr/local/php7.3/php/man/man1/ Installing PHP CGI binary: /usr/local/php7.3/bin/ Installing PHP CGI man page: /usr/local/php7.3/php/man/man1/ Installing build environment: /usr/local/php7.3/lib/php/build/ Installing header files: /usr/local/php7.3/include/php/ Installing helper programs: /usr/local/php7.3/bin/ program: phpize program: php-config Installing man pages: /usr/local/php7.3/php/man/man1/ page: phpize.1 page: php-config.1 Installing PEAR environment: /usr/local/php7.3/lib/php/ [PEAR] Archive_Tar - installed: 1.4.8
如果
/usr/local/php7.3/etc
没有找到php.ini
直接搜索源码里的
find / -name php.ini-production
然后复制过去
cp /home/php-7.3.16/php.ini-production /usr/local/php7.3/etc/php.ini
ps:如果找不到php-fpm 那重新编译安装php
--enable-fpm带上
php-fpm启动方法
cd /usr/local/php7.3/etc/php-fpm.d/
cp www.conf.default www.conf
/usr/local/php7.3/sbin/php-fpm