linux安装php,基于之前gd安装的文章,在此配置php集成gd库。
安装步骤:
1、 解压文件
gunzip php-xxx.tar.gz
tar -xvf php-xxx.tar
cd php-xxx
2、 配置,使其支持gd库
./configure -prefix=/usr/local/php/php5 -with-config-file-path=/usr/local/lib -with-apxs2=/usr/local/apache/bin/apxs -with-gd=/usr/local/gd -with-freetype-dir=/usr/local/freetype -with-jpeg-dir=/usr/local/jpeg8 -with-png-dir=/usr/local/libpng -with-zlib=/usr/local/zlib -enable-sockets -enable-track-vars
3、 编译:
# make
安装:
# make install
cp php.ini-dist /usr/local/lib/php.ini
4、 php与apache整合
vi /usr/local/apache2/conf/httpd.conf 找到DirectoryIndex改为如下:
DirectoryIndex index.html index.php index.htm index.html.var
找到
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
在它后面添加
AddType application/x-httpd-php .php
/usr/local/apache/bin/apachectl restart
5、 测试
vi /usr/local/apache2/htdocs/index.php
添加<?phpinfo();?>
打开浏览器,输入
http://127.0.0.1/index.php
可以看到关于php的信息,证明php安装成功。