编译安装php

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

详细配置地址:
https://www.php.net/manual/zh/configure.about.php

编译:

./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-curl --with-freetype-dir --with-gd --with-gettext --with-iconv-dir --with-kerberos --with-libdir=lib64 --with-libxml-dir --with-mysqli --with-pcre-regex --with-pdo-mysql --with-pdo-sqlite --with-pear --with-png-dir --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath --enable-libxml --enable-inline-optimization --enable-gd-native-ttf --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --enable-zip

make && make install

错误信息文档
https://www.cnblogs.com/architectforest/p/12433541.html

找不到php.ini文件
将编译安装包中的php.ini-development复制到php配置文件所在目录修改为php.ini

nginx配置文件没有问题时运行php文件出现file not found
修改php-fpm.conf中的user和group为固定用户

将php-fpm添加到systemctl

vi /usr/lib/systemd/system/php-fpm.service

将下面的代码添加到php-fpm.server中

[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target

[Service]
Type=forking
PIDFile=/var/run/php-fpm.pid  #打开php-fpm.conf找到 pid的配置路径
ExecStart=/usr/local/php/sbin/php-fpm  #php-fpm的启动路径
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

添加完成后执行 systemctl daemon-reload 重新加载就可以使用了

编译安装php扩展
进入php编译的安装包 进入到ext目录中选择所需要扩展 进入目录
执行phpize 会生成configure文件
找到php-config文件
执行 ./configure --with-php-config=文件地址 --with-所需扩展名

nginx文件解析漏洞
1.将php.ini文件中的cgi.fix_pathinfo的值设置为0
2.php-fpm.conf中的security.limit_extensions后面的值设置为.php

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值