溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

RedHat 7 安裝PHP

發(fā)布時(shí)間:2020-08-11 08:33:04 來(lái)源:ITPUB博客 閱讀:338 作者:甲骨文技術(shù)支持 欄目:建站服務(wù)器
1.操作系統(tǒng)版本

  1. [root@aws srclib]# cat /etc/redhat-release
  2. Red Hat Enterprise Linux Server release 7.4 (Maipo)
2.下載php安裝包,本例是5.6.30版本

  1. cd /usr/local/src
  2. wget http://cn2.php.net/distributions/php-5.6.30.tar.gz
3.解壓

  1. tar -xzvf php-5.6.30.tar.gz
4.執(zhí)行configure

  1. cd php-5.6.30
  2. ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php/etc --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif
5.在configure過(guò)程中遇到6個(gè)錯(cuò)誤,如下:

  1. 錯(cuò)誤1:
    configure: error: xml2-config not found. Please check your libxml2 installation.
    解決辦法:
    yum install -y libxml2-devel
    錯(cuò)誤2:
    configure: error: Cannot find OpenSSL's
    解決辦法:
    yum install -y openssl openssl-devel
    錯(cuò)誤3:
    configure: error: Please reinstall the BZip2 distribution
    解決辦法:
    yum install -y bzip2 bzip2-devel
    錯(cuò)誤4:
    configure: error: jpeglib.h not found.
    解決辦法:
    yum install -y libjpeg libjpeg-devel
    錯(cuò)誤5:
    configure: error: freetype-config not found.
    解決辦法:
    yum install -y freetype freetype-devel
    錯(cuò)誤6:
    configure: error: mcrypt.h not found. Please reinstall libmcrypt.
    解決辦法:
    yum install -y libmcrypt-devel
其中錯(cuò)誤6,需要安裝epel擴(kuò)展yum源,安裝方法如下:

  1. rpm -ivh "http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm"
6.上面的錯(cuò)誤都解決后就可以編譯和安裝了

  1. make
  2. make install
7.最后復(fù)制文件

  1. cp php.ini-production /usr/local/php/etc/php.ini

8.測(cè)試是否正確解析php

  1. vi /usr/local/apache2.4/htdocs/mytest.php //寫(xiě)入如下內(nèi)容
  2. <?php

  3.     echo "php測(cè)試正常"
  4. ?>

9.保存腳本后繼續(xù)測(cè)試,如下:

  1. [root@aws srclib]# curl localhost/mytest.php



  2. php測(cè)試正常
10.查看PHP配置文件所在位置

  1. [root@aws srclib]# /usr/local/php/bin/php -i |grep -i "loaded configuration file"
  2. PHP Warning: Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC
歡迎訪問(wèn)我的另一篇文章,RedHat 7 安裝httpd

http://blog.itpub.net/20893244/viewspace-2151184/




向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI