linux 安装 php
1. libxml2安装
tar -zxvf libxml2-2.6.26.tar.gz
cd libxml2-2.6.26
./configure --prefix=/usr/local/libxml
make
make install
make clean
2. zlib安装
tar -zxvf
zlib-1.2.3.tar.tar
cd
zlib-1.2.3
./configure
--prefix=/usr/local/zlib
make
make
install
make
clean
3. libpng安装
tar
-zxvf libpng-1.2.12.tar.gz
cd
libpng-1.2.12
./configure
--prefix=/usr/local/libpng
make
make
install
make
clean
4. jpeg安装
tar -zxvf jpegsrc.v6b.tar.tar
cd jpeg-6b
mkdir /usr/local/jpeg
mkdir /usr/local/jpeg/include
mkdir
/usr/local/jpeg/lib
mkdir
/usr/local/jpeg/bin
mkdir /usr/local/jpeg/man
mkdir /usr/local/jpeg/man1
mkdir /usr/local/jpeg/man/man1
./configure --prefix=/usr/local/jpeg
--enable-shared --enable-static
make
make install
make clean
5. 安装 freetype
tar -zxvf freetype-2.2.1.tar.gz
cd freetype-2.2.1
./configure --prefix=/usr/local/freetype
make
make install
6. GD安装
tar -zxvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure --prefix=/usr/local/gd --with-zlib
--with-png=/usr/local/libpng --with-jpeg=/usr/local/jpeg
--with-freetype=/usr/local/freetype
vi Makefile
编辑 Makefile 231行 将
CPPFLAGS = -I/usr/local/jpeg/include (该选项也可能为空,只要参考下面的修改就可以了)
改为
CPPFLAGS = -I/usr/local/jpeg/include
-I/usr/local/libpng/include
make
make install
make clean
7. libiconv安装
tar -zxvf
libiconv-1.9.2.tar.gz
cd
libiconv-1.9.2
./configure
--prefix=/usr/local/libiconv
make
make install
make clean
将iconv.h连接到php的安装源程序中(php的安装源程序必须要和iconv.h在同一磁盘目录下面,否则link会出错),否则会php
make会出错
cd
/usr/home/ty/php-5.1.6/ext/iconv/(该目录为php的安装源程序目录)
这里的php-5.1.6就是下面解压缩的路径
link /usr/local/libiconv/include/iconv.h iconv.h
8. 安装 openssl
tar -zxvf openssl-1.0.1c.tar.gz
cd openssl-1.0.1c
./config --prefix=/usr/local/openssl shared
make
make install
在/etc/ld.so.conf文件的最后面,添加如下内容:
/usr/local/openssl/lib
9. 安装curl
下载地址 http://curl.haxx.se/download/curl-7.17.1.tar.gz
tar -zxvf curl-7.17.1.tar.gz
cd curl
./configure --prefix=/usr/local/curl --with-ssl=/usr/local/openssl (先安装openssl 需注意)
curl version: 7.17.1
Host setup: x86_64-unknown-linux-gnu
Install prefix: /usr/local/curl
Compiler: gcc
SSL support: enabled (OpenSSL)(必须开启这个)
SSH support: no (--with-libssh2)
zlib support: enabled
krb4 support: no (--with-krb4*)
GSSAPI support: no (--with-gssapi)
SPNEGO support: no (--with-spnego)
c-ares support: no (--enable-ares)
ipv6 support: no (--enable-ipv6)
IDN support: no (--with-libidn)
Build libcurl: Shared=yes, Static=yes
Built-in manual: enabled
Verbose errors: enabled (--disable-verbose)
SSPI support: no (--enable-sspi)
ca cert path: ${prefix}/share/curl/curl-ca-bundle.crt
LDAP support: no (--enable-ldap / --with-ldap-lib / --with-lber-lib)
LDAPS support: no (--enable-ldaps)
make
make install
10. 安装PHP
tar -zxvf
php-5.3.27.tar.gz
cd
php-5.3.27
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-libxml-dir=/usr/local/libxml --with-mysql=/usr/local/mysql --with-curl=/usr/local/curl --with-zlib-dir=/usr/local/zlib --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/libpng --with-freetype-dir=/usr/local/freetype --with-iconv=/usr/local/libiconv --with-config-file-path=/usr/local/php/lib --with-gd=/usr/local/gd --disable-debug --disable-safe-mode --enable-short-tags --disable-posix --enable-exif --enable-ftp --enable-sockets -enable-mbstring=all
make
make install
make clean
cp /usr/src/php-5.3.27/php.ini-dist
/usr/local/php/lib/php.ini
11. 修改apache配置文件 httpd.conf
vi
/usr/local/apache/conf/httpd.conf
在httpd.conf文件相应的地方添加下面几行(如果在安装php5时,有的配置可以已经加上了,就不需要再重新添加了)
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php
.php
在DirectoryIndex index.html
index.html.var 后面添加index.php
配置完成... ..
12. 测试
写个测试脚本检查环境是否安装正常 可以 根据实际情况需要对 php.ini进行必要的修改
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。