PHP Frequently Asked Questions
1. 环境说明
2. 源码安装 libiconv
官网
1 2 3 4 5 6 7 8 9 10
| cd /usr/src
wget https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
tar -zxvf libiconv-1.16.tar.gz
./configure --prefix=/usr/local/libiconv
make && make install
|
3. 源码安装 php7
官网
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| cd /usr/src
rm -rf php-7.*
wget https://www.php.net/distributions/php-7.3.8.tar.gz
tar -zxvf php-7.3.8.tar.gz
rm php-7.3.8.tar.gz
cd php-7.3.8
./configure --prefix=/usr/local/php --with-iconv=/usr/local/libiconv --enable-fpm --with-pdo-mysql --with-curl --with-zlib
|
脚本配置成功
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| make test
killall php-fpm
make && make install
cd /usr/local/php/
cp /usr/src/php-7.3.8/php.ini-production lib/php.ini
cp etc/php-fpm.conf.default etc/php-fpm.conf
cp etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
./sbin/php-fpm
ps aux | grep php
netstat -anpo | grep php
|
3.1. phpinfo.php
3.1.1. nginx.conf
1 2 3 4 5 6 7
| location ~ \.php$ { root /www/php; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; }
|
4. 配置 php 模块
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| /usr/local/php/bin/php -m
cd /usr/src/php-7.3.8/ext/curl/
ln -s /usr/src/php-7.3.8/ext/ ./ext
/usr/local/php/bin/phpize
./configure -with-php-config=/usr/local/php/bin/php-config
make && make install
ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20180731/
vi /usr/local/php/lib/php.ini
/usr/local/php/sbin/php-fpm restart
|
编译安装可指定php.ini的路劲(多PHP版本共存的情况)
--with-config-file-path=/usr/local/php/etc
5. 配置文件
- wget 的使用 - tar 的使用 - configure 的使用 - make 的使用 |
./configure --prefix=/usr/local/php --with-iconv=/usr/local/libiconv
--enable-fpm --with-pdo-mysql