今天升级了自己开发机的php版本,干到了7.4,啥?你问我为啥要升级,不没有为啥,干就完事了,干的过程中遇到些问题
升级步骤
1.get 源码
1
| wget https://www.php.net/distributions/php-7.4.1.tar.gz
|
2.解压
1
| tar -zxf php-7.4.1.tar.gz
|
1
| ./configure --prefix=/usr/local/php7 --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-config-file-path=/usr/local/php7/etc --with-config-file-scan-dir=/usr/local/php7/etc/php.d --with-pcre-regex --with-zlib --with-openssl --enable-bcmath --with-curl --with-gd --with-freetype-dir=/usr/local/php7 --with-jpeg-dir=/usr/local/php7 --with-png-dir=/usr/local/php7 --enable-gd-native-ttf --with-gmp --with-mhash --enable-mbstring --with-mcrypt --with-pdo-mysql --with-readline --with-openssl-dir --with-xmlrpc --with-xsl --enable-zip --enable-mysqlnd --with-pear
|
从这儿开始就给整事了,出了问题,缺少两个包,这我能忍吗搞他
1)sqlite3
1
| No package 'sqlite3' found
|
其实是有这个包的但是版本有点不对,所以需要你搞个 sqlite-devel
1
| yum install sqlite-devel
|
2) oniguruma
1
| No package 'oniguruma' found
|
这个就是去安装包就行了
1
2
3
| yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-5.9.5-3.el7.x86_64.rpm
yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-devel-5.9.5-3.el7.x86_64.rpm
|
4. make
但是这儿又开始整事了,提示内部错误,当时我就懵了,只能再次谷歌了
1)内部错误
提示如下
1
2
3
4
5
6
| /bin/sh /root/php-7.4.1/libtool --silent --preserve-dup-deps --mode=compile cc -I/root/php-7.4.1/ext/fileinfo/libmagic -Iext/fileinfo/ -I/root/php-7.4.1/ext/fileinfo/ -DPHP_ATOM_INC -I/root/php-7.4.1/include -I/root/php-7.4.1/main -I/root/php-7.4.1 -I/root/php-7.4.1/ext/date/lib -I/usr/include/libxml2 -I/root/php-7.4.1/ext/mbstring/libmbfl -I/root/php-7.4.1/ext/mbstring/libmbfl/mbfl -I/root/php-7.4.1/TSRM -I/root/php-7.4.1/Zend -I/usr/include -g -O2 -fvisibility=hidden -Wall -Wno-strict-aliasing -DZEND_SIGNALS -c /root/php-7.4.1/ext/fileinfo/libmagic/apprentice.c -o ext/fileinfo/libmagic/apprentice.lo
cc: 编译器内部错误:已杀死(程序 cc1)
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
make: *** [ext/fileinfo/libmagic/apprentice.lo] 错误 1
|
这就是内存不够了,之前编译还是没问题的,现在不够了,只能临时加个交换空间了
1
2
3
| sudo dd if=/dev/zero of=/home/swap bs=64M count=16
sudo mkswap /home/swap
sudo swapon /home/swap
|
make成功后关闭交换空间
1
2
| sudo swapoff /home/swap
sudo rm /home/swap
|
5.搞到默认运行环境
1
2
3
4
| cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
ln -sf /usr/local/php7/bin/php /usr/local/bin/php
ln -sf /usr/local/php7/bin/php /usr/bin/php
|
这就算是升级完了