银河麒麟V10 源码编译安装php7.4
下载地址 https://www.php.net/distributions/php-7.4.33.tar.xz
安装依赖包,准备编译
bash
dnf install libxml2-devel sqlite-devel bzip2-devel libcurl-devel libjpeg-turbo-devel freetype-devel openldap-devel libtool-devel pcre2-devel nettle-devel libzip gmp-devel oniguruma-devel readline-devel net-snmp-devel libxslt-devel libssh2-devel libevent-devel python3-mysqlclient
tar xf php-7.4.33.tar.xz
cd php-7.4.33
./configure --prefix=/usr --with-curl --with-freetype --enable-gd --with-jpeg --with-gettext --with-gmp --with-mysqli --with-openssl --with-pdo-mysql --with-xmlrpc --with-xsl --with-mhash --enable-fpm --enable-bcmath --enable-mbstring --enable-sockets --enable-xml --enable-embed --enable-phpdbg --with-ldap --with-snmp --with-bz2 --enable-calendar --with-curl --enable-exif --enable-ftp --enable-pcntl --with-zlib --with-readline --enable-shmop --enable-sockets
ln -s /usr/lib64/libldap.so /usr/lib
ln -s /usr/lib64/liblber.so /usr/lib
make && make install
安装完php修改nginx配置
解开注释,将/scripts改为$document_root
bash
fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name
bash
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
上面配置不做修改就会报 File not found.
通过查看nginx报错日志发现包含这样的错误FastCGI sent in stderr: "Primary script unknown"