php-5.4.6安装[阮胜昌]

安  装:
tar zvxf php-4.3.4.tar.gz
cd php-4.3.4
./configure \
--prefix=/usr/local/php \        //指定php安装路径   
--with-mysql=/usr/local/mysql \   //指定数据库的路径
--enable-force-cgi-redirect \     
--with-freetype-dir=/usr \
--with-png-dir=/usr \
--with-gd --enable-gd-native-ttf \
--with-ttf \
--with-gdbm \
--with-gettext \
--with-iconv \
--with-jpeg-dir=/usr \
--with-png \
--with-zlib \
--with-xml \
--enable-calendar \
--with-config-file-path=/usr/local/php  //指定配置文件位置
--with-apxs2=/usr/local/apache/bin/apxs   //通过Apache访问PHP页面了。         //红色为必选项

后加配置++++++++++
--with-libxml-dir=/usr/local/libxml2
--with-png-dir=/usr/local/libpng
--with-jpeg-dir=/usr/local/jpeg6
--with-freetype-dir=/usr/local/freetype
--with-gd=/usr/local/gd2
--with-zlib-dir=/usr/local/zlib
--with-mcrypt=/usr/local/libmcrypt
--with-mysqli=/usr/local/mysql/bin/mysql_config //变量激活新增加mysqli功能
--enable-soap //激活SOAP和web services支持
--enable-mbstring=all //使多字节字符串支持
--enable-sockets //激活socket通信特性
+++++++++++

./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --enable-force-cgi-redirect --with-freetype-dir=/usr --with-gd --enable-gd-native-ttf --with-ttf --with-gdbm --with-gettext --with-iconv --with-jpeg-dir=/usr --with-png --with-zlib --with-xml --enable-calendar --with-apxs2=/usr/local/apache2/bin/apxs

make
make install
配  置:

[root@node201 lib]# cp php.ini-development /usr/local/php/lib/php.ini     //复制源文件的php.ini-development 到安装目录
修改apache配置文件来支持php
cd /usr/local/apache2/conf
vim httpd.conf
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    LimitRequestBody   20971520
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
LoadModule php5_module        modules/libphp5.so          //添加以上代码成功
③Directory  Index    index.html  index.php(添加)
④DocumentRoot   "/usr/local/apache2/htdocs"(index.html  index.php所在根目录)

测试是否支持php
cd /usr/local/apache2/htdocs
vim info.php
<?php phpinfo(); ?>
 

你可能感兴趣的:(安装,胜)