PHP編譯安裝

來源:互聯網
上載者:User

標籤:php編譯安裝

php官方: http://www.php.net/downloads.php

下載php:

[[email protected] httpd-2.2.16]# cd /usr/local/src[[email protected] src]# wget http://am1.php.net/distributions/php-5.3.27.tar.gz

解壓:

[[email protected] src]# tar zxvf php-5.3.27.tar.gz (bz2格式用:tar jvxf .....)

配置編譯參數:

[[email protected] src]# cd php-5.3.27[[email protected] php-5.3.27]# ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc  --with-mysql=/usr/local/mysql --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 --disable-ipv6

在這一步,遇到如下錯誤:

configure: error: xml2-config not found. Please check your libxml2 installation.

解決辦法是:

yum install -y libxml2-devel

還有錯誤:

configure: error: Cannot find OpenSSL‘s <evp.h>

解決辦法是:

yum install -y openssl openssl-devel

錯誤:

checking for BZip2 in default path... not foundconfigure: error: Please reinstall the BZip2 distribution

解決辦法:

yum install -y bzip2 bzip2-devel

錯誤:

configure: error: png.h not found.

解決辦法:

yum install -y libpng libpng-devel

錯誤:

configure: error: freetype.h not found.

解決辦法:

yum install -y freetype freetype-devel

錯誤:

configure: error: mcrypt.h not found. Please reinstall libmcrypt.

解決辦法:

rpm -ivh "http://www.aminglinux.com/bbs/data/attachment/forum/month_1211/epel-release-6-7.noarch.rpm" 或   yum install -y epel-releaseyum install -y  libmcrypt-devel

因為centos6.x 預設的yum源沒有libmcrypt-devel 這個包,只能藉助第三方yum源或者epel的yum源。

在這一步,也許還會遇到諸多錯誤,遇到上面未列出的錯誤時,請參照    http://blog.sina.com.cn/s/blog_167f23bf50102xdki.html

編譯:

[[email protected] php-5.3.27]# make

安裝:

[[email protected] php-5.3.27]# make install

拷貝設定檔:

[[email protected] php-5.3.27]# cp php.ini-production /usr/local/php/etc/php.ini

Apache主設定檔為:/usr/local/apache2/conf/httpd.conf

#vim /usr/local/apache2/conf/httpd.conf

找到:

AddType application/x-gzip .gz .tgz

在該行下面添加:

AddType application/x-httpd-php .php

找到:

<IfModule dir_module>

   DirectoryIndex index.html + index.php

</IfModule>

在DirectoryIndex index.htm後面加上index.php

找到:

<IfModule dir_module>    DirectoryIndex index.html</IfModule>

將該行改為:

<IfModule dir_module>    DirectoryIndex index.html index.htm index.php</IfModule>

找到:

#ServerName www.example.com:80

修改為:

ServerName localhost:80


本文出自 “12350027” 部落格,謝絕轉載!

PHP編譯安裝

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.