当前位置: > CentOS > CentOS服务器 > 环境配置 >

CentOS6.5系统搭建php服务器

时间:2015-05-15 12:17来源:linux.it.net.cn 作者:IT

下面我们开始编译安装PHP5.4.33

首先下载源码包到用户目录下, 下载PHP5.4.33

也可以使用命令行下载:

wget http://kr1.php.net/get/php-5.4.33.tar.bz2/from/this/mirror -O php-5.4.33.tar.bz2

tar -jxvf php-5.4.33.tar.bz2

安装php需要的一些包

yum -y install libmcrypt libmcrypt-devel bzip2-devel libxml2 libxml2-devel libcurl.x86_64 libcurl-devel.x86_64 

1
epel-release
[root@diguojin ~]# cd /usr/local/src/php-5.4.33/
[root@diguojin php-5.4.33]# ./configure --prefix=/usr/local/php-5.4.33 \
--with-mysql=/usr/local/mysql-5.5.40/ \ #MySQL安装目录
--with-openssl=/usr/local/openssl-1.0.1i/ \ #OpenSSL安装目录
--with-mysqli=/usr/local/mysql-5.5.40/bin/mysql_config \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir \
--with-apxs2=/usr/local/httpd24/bin/apxs #指向Apache安装目录下/bin/apxs
--with-mcrypt \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--with-bz2 \
--enable-xml \
--enable-sockets \
--enable-maintainer-zts \
--enable-mbstring

[root@diguojin php-5.4.33]# make && make install

vim /etc/httpd24/httpd.conf

添加如下两行

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

 

定位至DirectoryIndex index.html

修改为

DirectoryIndex index.php index.html

(责任编辑:IT)
------分隔线----------------------------