LAMP手动配置 2——PHP

以下所有操作均在Ubuntu下测试。


1、从php官方(http://www.php.net/)下载源码包,以5.5.13为例


2、解压源文件


      tar -jxvf php-5.5.13.tar.bz2


3、安装编译所需的软件


这一步具体按照自己需要的扩展来安装,不详细说


4、配置


./configure --prefix=/usr/local/php --enable-fpm  --with-mcrypt=/usr/local/libmcrypt --with-zlib --enable-mbstring --with-openssl --with-mysql --with-mysqli --with-mysql-sock --with-gd --with-jpeg-dir=/usr/lib --enable-gd-native-ttf  --enable-pdo --with-pdo-mysql --with-gettext --with-curl --with-pdo-mysql --enable-sockets --enable-bcmath --enable-xml --with-bz2 --enable-zip --enable-freetype --with-apxs2=/usr/sbin/apxs



5、编译,安装

    make && make install


6、作一些配置

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

     打开php.ini 约919行  设置默认的时区为上海

     date.timezone = "Asia/Shanghai"


     打开apache的配置文件 httpd.conf(一般在/etc/httpd/conf/httpd.conf)

     确认有以下内容,如果没有则添加


    DirectoryIndex index.html index.php

    AddType application/x-httpd-php .php

    PHPIniDir "/etc/"

    LoadModule php5_module modules/libphp5.so


    重启apache:service httpd restart


你可能感兴趣的:(LAMP手动配置 2——PHP)