RHEL5上组建Apache+SSL+PHP+PostgreSQL环境详解(三)
来源:互联网 发布:js 浏览器兼容问题 编辑:程序博客网 时间:2024/05/15 01:43
接上例:http://blog.csdn.net/kunshan_shenbin/archive/2008/12/20/3566651.aspx
7.安装PHP,地址:http://www.php.net/
在安装php之前,我们需要安装一系列php的支持库。
A.安装 libxml2
# tar -zxvf libxml2-2.6.19.tar.gz
# cd libxml2-2.6.19
# ./configure --prefix=/usr/local/libxml2
# make
# make install
B.安装 zlib
# tar -zxvf zlib-1.2.3.tar.gz
# cd zlib-1.2.3
# ./configure --prefix=/usr/local/zlib
# make
# make install
C.安装 libpng
# tar -zxvf libpng-1.2.10.tar.gz
# cd libpng-1.2.10
# cp scripts/makefile.linux makefile
# make
# make install
D.安装 freetype
# tar -zxvf freetype-2.2.1.tar.gz
# cd freetype-2.2.1
# ./configure --prefix=/usr/local/freetype
# make
# make install
E.安装 jpeg6
建立目录
# mkdir /usr/local/jpeg6
# mkdir /usr/local/jpeg6/bin
# mkdir /usr/local/jpeg6/lib
# mkdir /usr/local/jpeg6/include
# mkdir /usr/local/jpeg6/man
# mkdir /usr/local/jpeg6/man/man1
# tar -zxvf jpegsrc.v6b.tar.gz
# cd jpeg-6b
# ./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static
# make
# make install
F.安装 gd
# tar -zxvf gd-2.0.33.tar.gz
# cd gd-2.0.33
# ./configure --prefix=/usr/local/gd --with-png=/usr/local/lib --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/jpeg6
# make
# make install
G.安装 curl 支持ftp库函数
# tar -zxvf curl-7.15.0.tar.gz
# cd curl-7.15.0
# ./configure --prefix=/usr/local/curl
# make
# make install
H.安装 php5
# tar -zxvf php-5.1.6.tar.gz
# cd php-5.1.6
# ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/etc --with-libxml-dir=/usr/local/libxml2 --with-zlib-dir=/usr/local/zlib --with-curl=/usr/local/curl --with-gd=/usr/local/gd --with-jpeg-dir=/usr/local/jpeg6 --with-png-dir=/usr/local/lib --with-freetype-dir=/usr/local/freetype --with-pgsql=/usr/local/pgsql --with-openssl --enable-gd-native-ttf --enable-mbstring --enable-ftp --enable-bcmath --enable-sockets --enable-zip --enable-soap --enable-calendar
# make
# make install
# cp php.ini-dist /etc/php.ini
# libtool --finish /home/install/php-5.1.6/libs (/home/install为安装目录)
#
8.PHP与Apache的整合
apache配置文件/usr/local/apache2/conf/httpd.conf
部分属性说明:
ServerRoot "/usr/local/apache2" #这是指定apache程序所在的目录,比如日志文件、配置文件等目录。
DocumentRoot "/usr/local/apache2/htdocs" #这个是存放网页的目录
<Directory "/usr/local/apache2/htdocs"> #这一句应该和DocumentRoot的目录保持一致。
找到:DirectoryIndex index.html
改为:DirectoryIndex index.html index.html.var index.htm index.php
找到:AddType application/x-gzip .gz .tgz
后加:AddType application/x-httpd-php .php (注意空格)
AddType application/x-httpd-php-source .phps
添加:AddDefaultCharset utf8 使apache默认支持utf8字符集
确认:LoadModule php5_module modules/libphp5.so 是否存在。
编辑php.ini文件,默认位置:/etc/php.ini
找到:;default_charset="iso-8859-1"
后加:default_charset="utf8"
注意:
下载源码包 make && make install 之后, apache 并不会自动往 init.d 里面添加自己的 httpd service。需要手工把 apache 安装目录的 bin/apachectl 拷贝一份到 /etc/init.d/httpd 。如果想让 httpd service 能够在不同的运行级别下都能自动启动,还需要 vi /etc/init.d/httpd ,在 #!/bin/sh 下面增加几行 chkconfig 需要的内容:
- # chkconfig: 2345 70 30
- # description: Apache is a World Wide Web server. It is used to serve /
- # HTML files and CGI.
- # processname: httpd
关键是 chkconfig: 2345 70 30 这一行,第一个数字 2345 表示让 apache 在 2345 这四个级别都自动运行;第二个数字 70 表示进程启动的优先级;第三个数字 30 表示进程停止的优先级。修改保存之后执行 /sbin/chkconfig httpd reset ,chkconfig 就自动在各个级别的 rc*.d 中增加 httpd 的 link 。要查看 chkconfig 是否 reset 正确,通过命令 /sbin/chkconfig --list httpd 就可以查看当前 httpd service 被配置在哪几个运行级别自启动。
注意:
每次更改配置文件。要重启服务。
对存放网页的目录执行:命令chmod 755 目录名 或者 chmod -R 755 目录名
- RHEL5上组建Apache+SSL+PHP+PostgreSQL环境详解(三)
- RHEL5上组建Apache+SSL+PHP+PostgreSQL环境详解(一)
- RHEL5上组建Apache+SSL+PHP+PostgreSQL环境详解(二)
- Linux+Apache+PHP+MySQL+SSL配置详解
- Linux+Apache+PHP+MySQL+SSL配置详解
- RHEL4环境部署Linux+Apache+MySQL+PostgreSQL+PHP环境
- 组建php环境时,配置apache对php的支持【问题记录】
- rhel5下编译php环境
- Linux环境安装Apache与PHP,支持SSL
- 重新安装postgresql+apache+php
- Windows Server 2016 上配置 APACHE+SSL+PHP+perl
- 【PHP项目部署三】Apache环境配置
- Ubuntu上搭建 Apache + PHP + MySQL 环境
- Ubuntu上搭建 Apache + PHP + MySQL 环境
- Windows7系统上配置Apache+php环境
- PostgreSQL在RHEL5上的安装和简单使用
- 在RHEL5上搭建LAMP环境
- RHEL5上配置LNMP环境安装shopex
- 学习“系统程序员成长计划-谁动了你的隐私(上)”
- Java vs. .NET:就业市场和薪资比较
- 四种进程或线程同步互斥的控制方法
- 在winform中使用程序读取和修改App.config里面的appSettings当中的Value值
- stl的string的大小写转换函数
- RHEL5上组建Apache+SSL+PHP+PostgreSQL环境详解(三)
- 手指半月痕,健康标志
- POJ BUG
- 积食
- 实现JComboBox中添加自定义对象
- super stl plan
- lucene 2.4的api变化。。。
- 纪念我的母亲
- 【Derby 系列】[初级-1]从源代码构建Derby