国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 服務器 > Web服務器 > 正文

Centos7.2 編譯安裝PHP7.0.2的步驟

2024-09-01 13:52:08
字體:
來源:轉載
供稿:網友

環境

  1. 系統:centos/256875.html">Centos7.2 
  2. 服務:Nginx

1:下載PHP7.0.2的安裝包解壓,編譯,安裝:

  $ cd /usr/src/  $ wget http://cn2.php.net/distributions/php-7.0.2.tar.gz  $ tar -xzxvf php-7.0.2.tar.gz  $ cd php-7.0.2

1.1編譯前檢查

請檢查是否安裝了gcc ,沒有的話執行yum install gcc

檢查是否安裝了libxml2 ,沒有的話執行yum install libxml2

檢查是否安裝了libxml2-devel,沒有的話執行yum install libxml2-devel

注:因為改為用nginx了,所以編譯參數中的--with-apxs2=/usr/bin/apxs去掉了,如果要配置apache用,安裝PHP前,請先安裝apache。*

2:編譯參數配置

 

復制代碼 代碼如下:

'./configure' '--prefix=/usr/local/php' '--with-pdo-pgsql' '--with-zlib-dir' '--with-freetype-dir' '--enable-mbstring' '--with-libxml-dir=/usr' '--enable-soap' '--enable-calendar' '--with-curl' '--with-mcrypt' '--with-gd' '--with-pgsql' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-zlib' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-pcntl' '--enable-mbregex' '--enable-exif' '--enable-bcmath' '--with-mhash' '--enable-zip' '--with-pcre-regex' '--with-pdo-mysql' '--with-mysqli' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--with-openssl' '--with-fpm-user=www-data' '--with-fpm-group=www-data' '--with-libdir=/lib/x86_64-linux-gnu/' '--enable-ftp' '--with-gettext' '--with-xmlrpc' '--with-xsl' '--enable-opcache' '--enable-fpm' '--with-iconv' '--with-xpm-dir=/usr'

 

3:錯誤集合

報錯 Cannot find OpenSSL's <evp.h> 執行 yum install openssl openssl-devel報錯 Please reinstall the libcurl distribution 執行 yum -y install curl-devel錯誤 jpeglib.h not found 執行 yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 -y 和執行 yum install libjpeg-devel錯誤:checking for BZip2 in default path... not found configure: error: Please reinstall the BZip2 distribution 這是bzip2軟件包沒有安裝 執行 yum install bzip2-devel.x86_64 -y錯誤:configure: error: xpm.h not found. 執行 yum install libXpm-devel錯誤: Unable to locate gmp.h 執行 yum install gmp-devel錯誤:Unable to detect ICU prefix or /usr//bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works 執行 yum install -y icu libicu libicu-devel錯誤:mcrypt.h not found. Please reinstall libmcrypt. 執行 yum install php-mcrypt libmcrypt libmcrypt-devel錯誤: configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path 執行 yum install postgresql-devel錯誤: configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution 執行 yum install libxslt-devel

4:編譯

make clean && make && make install

5:PHP配置

5.1安裝完成后,我們要把源碼包中的配置文件復制到PHP安裝目錄下,源碼包中有兩個配置 php.ini-development php.ini-production ,看名字就知道,一個是開發環境,一個是生產環境,我們這里就復制開發環境的

cp php.ini-development /usr/local/php/lib/php.ini

5.2另外還需要設置環境變量 :修改/etc/profile文件使其永久性生效,并對所有系統用戶生效,在文件末尾加上如下兩行代碼

PATH=$PATH:/usr/local/php/binexport PATH

5.3 然后執行生效命令

source /etc/profile

5.4查看PHP版本信息

php -v

6:配置PHP-fpm

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.confcp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.confcp /usr/src/php-7.0.2/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpmchmod +x /etc/init.d/php-fpm

6.1 啟動php-fpm:

/etc/init.d/php-fpm start

6.2 如果出現錯誤:ERROR: [pool www] cannot get uid for user 'www-data'

則新建www-data 用戶組:

groupadd www-datauseradd -g www-data www-data

6.3 重啟php-fpm

/etc/init.d/php-fpm restart

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 普安县| 柳州市| 昆山市| 通化县| 丹凤县| 无锡市| 平武县| 淳安县| 莆田市| 通渭县| 平罗县| 兰考县| 东平县| 汝阳县| 西贡区| 司法| 银川市| 开远市| 天峨县| 怀远县| 吴旗县| 商南县| 兴安盟| 明星| 宁蒗| 巩义市| 新野县| 正安县| 贺兰县| 西昌市| 城口县| 江津市| 阳西县| 分宜县| 正蓝旗| 兴国县| 武宣县| 云阳县| 金乡县| 潞西市| 观塘区|