标签:led 解压 php -v ssl soft err 需要 etc RoCE
下载PHP源代码1.安装依赖
其次,需要安装一些编译PHP所需要的依赖
sudo apt update
sudo apt install gcc
sudo apt install make
sudo apt install openssl
sudo apt install curl
sudo apt install libbz2-dev
sudo apt install libxml2-dev
sudo apt install libjpeg-dev
sudo apt install libpng-dev
sudo apt install libfreetype6-dev
sudo apt install libzip-dev
2.预编译PHP
在编译前,需要对PHP进行配置,以供其生成对应的makefile文件
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysqli --with-pdo-mysql --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --enable-mbregex --enable-mbstring --enable-ftp --with-gd --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --disable-fileinfo --enable-maintainer-zts
配置成功后会出现如下字样
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+
Thank you for using PHP.
3.编译并安装PHP
make
make install
4.验证PHP
可以使用如下指令来输出PHP的版本,来验证是否正确安装
/usr/local/php/bin/php -v
如果正确安装,将会出现如下内容
PHP 7.3.1 (cli) (built: Jan 18 2019 20:11:04) ( ZTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.1, Copyright (c) 1998-2018 Zend Technologies
到这一步为止,PHP7.3.1便成功从源代码编译安装了。
5.复制php.ini
编译安装后的目录并不会有现成的php.ini,需要手动复制过去。
在解压出来的源代码目录中,有供开发环境使用的php.ini-development和供生产环境使用的php.ini-production。
cp php.ini-development /usr/local/php/etc/php.ini
cp /usr/local/php5/etc/php-fpm.conf.default /usr/local/php5/etc/php-fpm.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
/usr/local/php5/sbin/php-fpm
启动php报错
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
#/usr/local/php/sbin/php-fpm
[29-Nov-2019 13:04:49] ERROR: [pool www] cannot get uid for user ‘www‘
[29-Nov-2019 13:04:49] ERROR: FPM initialization failed
创建www用户组
直接创建nginx用户和用户组
useradd nginx
groupadd nginx
usermod -G nginx nginx
/usr/local/php5/sbin/php-fpm
标签:led 解压 php -v ssl soft err 需要 etc RoCE
原文地址:https://blog.51cto.com/11353391/2455316