1.4 php編譯安裝-安裝順序在最後

#cd /usr/local/src    php

#wget http://mirrors.sohu.com/php/php-5.4.44.tar.gzhtml

#tar zxf php-5.4.44.tar.gz      //解壓源碼包mysql

#./configure \   linux

--prefix=/usr/local/php \sql

--with-apxs2=/usr/local/apache2/bin/apxs \apache

--with-config-file-path=/usr/local/php/etc  \centos

--with-mysql=/usr/local/mysql \app

--with-libxml-dir \socket

--with-gd \ide

--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 found

configure: 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: jpeglib.h not found.

解決方法: yum install libjpeg-devel

錯誤:

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

centos6.x 默認的yum源沒有libmcrypt-devel 這個包,只能藉助第三方yum源,解決辦法:

rpm -ivh "http://www.aminglinux.com/bbs/data/attachment/forum/month_1211/epel-release-6-7.noarch.rpm"

yum install -y  libmcrypt-devel

 

3rpm包,安裝對應的rpm

centos5 32epel源下載地址: www.lishiming.net/data/attachment/forum/epel-release-5-4_32.noarch.rpm

64位下載地址:  www.lishiming.net/data/attachment/forum/epel-release-5-4_64.noarch.rpm

 

centos6

32epel yum源下載地址: www.lishiming.net/data/attachment/forum/epel-release-6-8_32.noarch.rpm

64位下載地址: www.lishiming.net/data/attachment/forum/epel-release-6-8_64.noarch.rpm

#make        //編譯

#make install       //安裝

#cp php.ini-production /usr/local/php/etc/php.ini     //拷貝php配置文件

# vi /usr/local/apache2/conf/httpd.conf             //修改apache配置文件

修改:

<Directory />

    Options FollowSymLinks

    AllowOverride None

    Order deny,allow

    Deny from all

</Directory>

改成:

<Directory />

    Options FollowSymLinks

    AllowOverride None

    Order deny,allow

    Allow from all          //不修改訪問網站會禁止訪問,顯示403

</Directory>

找到:

AddType application/x-compress .Z

AddType application/x-gzip .gz .tgz

添加:

AddType application/x-httpd-php .php             //支持php解析,加上對應類型

找到:

<IfModule dir_module>

    DirectoryIndex index.html

</IfModule>

改成:

<IfModule dir_module>

    DirectoryIndex index.html index.htm index.php           //針對php索引,默認頁爲index.php,需加上index.php

</IfModule>

找到:

#ServerName www.example.com:80

改成:

ServerName localhost:80

查看配置文件是否有文化:

#/usr/local/apache2/bin/apachectl –t     //顯示syntax  OK,配置沒問題

# /usr/local/apache2/bin/apachectl start      //啓動服務

# ps aux|grep httpd          //檢查是否有進程列表

相關文章
相關標籤/搜索