Skip to content

Latest commit

 

History

History
109 lines (69 loc) · 3.32 KB

4.27-php编译安装.md

File metadata and controls

109 lines (69 loc) · 3.32 KB

下载PHP

cd /usr/local/src
wget http://cn2.php.net/distributions/php-7.3.0.tar.bz2

解压

tar jxvf php-7.3.0.tar.bz2

编译

cd php-7.3.0
编译参数:
./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-pear --with-curl --with-openssl

make
make install 

配置文件:

cd /usr/local/php-fpm/
cp php-fpm.conf.default php-fpm.conf
cd /usr/local/src/php-7.3.0
cp php.ini-development  /usr/local/php-fpm/etc/php.ini
cd /usr/local/php-fpm/etc/php-fpm.d/
cp www.conf.default www.conf

启动脚本:

cd /usr/local/src/php-7.3.0
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chkconfig --add php-fpm
chkconfig php-fpm on
chmod 755 /etc/init.d/php-fpm 

补充:

vi 里面在一般模式下,按dd可以删除行(剪切),5dd(剪切5行),光标挪到要粘贴的位置,按p。
操作错误之后,想要撤销,可以按u,反着撤销按 ctrl r; 
一般模式下按gg可以把光标定位到首行,按G可以定位到末行; 
按yy复制,5yy复制5行;
显示行号,在一般模式里输入:set nu; 
定位到指定的行:一般模式下直接按数字G,如10G

编译安装一个软件包的步骤:

./configure  ; make; make install 

grep -i 忽略大小写

错误1:

checking for cc... no
checking for gcc... no
解决: yum install -y gcc

错误2:

error: libxml2 not found
解决:yum install -y libxml2-devel

错误3:

error: Cannot find OpenSSL's
解决:yum install -y openssl-devel

错误4:

error: cURL version 7.15.5 or later is required 
解决:yum install -y libcurl-devel

错误5:

configure: error: jpeglib.h not found
解决:yum install -y libjpeg-turbo-devel

错误6:

configure: error: png.h not found
解决:yum install -y libpng-devel

错误7:

configure: error: freetype-config not found.
解决: yum install -y freetype-devel

错误8:

configure: error: wrong mysql library version or lib not found
解决:下载一个低版本的MySQL/Mariadb
wget http://mirrors.163.com/mysql/Downloads/MySQL-5.6/mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
tar jxvf mysql-5.6.39-linux-glibc2.12-x86_64.tar.gz
mv mysql-5.6.39-linux-glibc2.12-x86_64 /usr/local/mysql5.6
改编译参数
./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql5.6 --with-mysqli=/usr/local/mysql5.6/bin/mysql_config --with-pdo-mysql=/usr/local/mysql5.6 --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-pear --with-curl --with-openssl

错误9:

ERROR: [pool www] cannot get uid for user 'php-fpm'
解决:useradd  php-fpm

补充:

diff 查看两个文件的差异的,如 diff 1.txt 2.txt