安裝php擴充套件依賴
新增組和新增使用者
編譯安裝
上面的步驟有可能出現的問題
配置php.ini檔案
配置systemd服務
設定php-fpm埠
wget
tar zxvf php-7.3.6.tar.gz
cd php-7.3.6
yum -y install gcc gcc-c++ kernel-devel
yum -y install wget pcre pcre-devel openssl openssl-devel libicu-devel autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses ncurses-devel curl curl-devel krb5-devel libidn libidn-devel openldap openldap-devel nss_ldap jemalloc-devel cmake boost-devel bison automake libevent libevent-devel gd gd-devel libtool* libmcrypt libmcrypt-devel mcrypt mhash libxslt libxslt-devel readline readline-devel gmp gmp-devel libcurl libcurl-devel openjpeg-devel gdbm-devel
#新增組
groupadd www
#新增使用者
useradd -g www www
./configure --prefix=/usr/local/webservice/php73
–with-config-file-path=/usr/local/webservice/php73/etc
–with-fpm-user=www
–with-fpm-group=www
–with-mysqli=mysqlnd
–with-pdo-mysql=mysqlnd
–with-iconv-dir
–with-freetype-dir
–with-jpeg-dir
–with-png-dir
–with-zlib
–with-libxml-dir
–with-ldap=shared
–with-gdbm
–with-pear
–with-gettext
–with-curl
–with-xmlrpc
–with-openssl
–with-mhash
–with-gd
–enable-fpm
–enable-mysqlnd
–enable-mysqlnd-compression-support
–enable-xml
–enable-rpath
–enable-bcmath
–enable-shmop
–enable-sysvsem
–enable-inline-optimization
–enable-mbregex
–enable-mbstring
–enable-intl
–enable-ftp
–enable-gd-jis-conv
–enable-pcntl
–enable-sockets
–enable-zip
–enable-soap
–enable-fileinfo
–enable-opcache
–enable-maintainer-zts \
make -j 4 && make install
1、configure: warning: unrecognized options: --with-mcrypt, --with-libmbfl, --enable-gd-native-ttf
說明上面的配置引數已經棄用了,刪除即可。
2、configure: error: dba: could not find necessary header file(s).
安裝下 yum install gdbm-devel
3、configure: error: cannot find ldap libraries in /usr/lib
拷貝下檔案 cp -frp /usr/lib64/libldap* /usr/lib/
4、configure: error: off_t undefined; check your library configuration
進行如下操作:
vi /etc/ld.so.conf
#新增如下幾行
/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64
#儲存退出
:wq#使之生效
ldconfig -v
5、configure: error: please reinstall the libzip distribution
tar zxvf libzip-1.5.2.tar.gz
cd libzip-1.5.2
mkdir build && cd build && cmake … && make && make install
6、cmake 3.0.2 or higher is required. you are running version 2.8.12.2
說明你的cmake版本過低,需要重新安裝
先刪除原有cmake
yum remove cmake
tar zxvf cmake-3.14.3.tar.gz
cd cmake-3.14.3
./bootstrap && make && make install
然後修改 vi /etc/profile,並加入如下內容
path=/usr/local/bin:$path
export path
source /etc/profile
7、internal compiler error: killed (program cc1plus)
please submit a full bug report,
主要原因大體上是因為記憶體不足,有點坑 臨時使用交換分割槽來解決吧
sudo dd if=/dev/zero of=/swapfile bs=64m count=16
sudo mkswap /swapfile
sudo swapon /swapfile
安裝完成後,執行刪除交換分割槽
sudo swapoff /swapfile
sudo rm /swapfile
具體的路徑,大家可自行修改。
cp php.ini-development /usr/local/webservice/php73/etc/php.ini
cp /usr/local/webservice/php73/etc/php-fpm.conf.default /usr/local/webservice/php73/etc/php-fpm.conf
cp /usr/local/webservice/php73/etc/php-fpm.d/www.conf.default /usr/local/webservice/php73/etc/php-fpm.d/www.conf
配置php.ini檔案
max_execution_time = 120
max_input_time = 120
memory_limit = 1024m
post_max_size = 128m
date.timezone = prc
extension_dir = 「/usr/local/webservice/php73/lib/php/extensions/no-debug-zts-20180731」
其實php-fpm.service檔案php已經幫我們配置好了,只需要我們複製到指定位置,並啟用就行了。
cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/php-fpm
將php和php-fpm軟鏈到/usr/bin
ln -s /usr/local/webservice/php73/bin/php /usr/bin/php
ln -s /usr/local/webservice/php73/sbin/php-fpm /usr/sbin/php-fpm
systemctl daemon-reload
vim /usr/local/webservice/php73/etc/php-fpm.d/www.conf
listen = 127.0.0.1:9073
設定php-fpm.service開機啟動
systemctl enable php-fpm.service
啟動php-fpm
systemctl start php-fpm.service
CentOS 7 編譯安裝 PHP 7
使用編譯的方式來安裝 php 7。輸入yum y install libxml2 libxml2 devel openssl openssl devel curl devel libjpeg devel libpng devel freetype devel libmcrypt devel mhas...
CentOS 7 編譯安裝 PHP 7
使用編譯的方式來安裝 php 7。輸入yum y install libxml2 libxml2 devel openssl openssl devel curl devel libjpeg devel libpng devel freetype devel libmcrypt devel mhas...
Centos7 編譯安裝PHP7
centos7 編譯安裝php7 yum groupinstall development tools 2 安裝依賴包 yum install libxml2 libxml2 devel openssl openssl devel bzip2 bzip2 devel libcurl libcurl ...