分类 linux服务器 下的文章

linux下搭建 php环境

下载 依赖包及apache安装包:
wget http://apache.fayea.com//httpd/httpd-2.4.20.tar.gz
wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
安装依赖包 及 Apache:

tar -zxf apr-1.4.5.tar.gz  
cd  apr-1.4.5
./configure --prefix=/home/users/v_jiazhizhong/apache2/apr
make && make install

tar -zxf apr-util-1.3.12.tar.gz
cd  apr-util-1.3.12
./configure --prefix=/home/users/v_jiazhizhong/apache2/apr-util -with-apr=/home/users/v_jiazhizhong    /apache2/apr/bin/apr-1-config
make && make install

unzip -o pcre-8.10.zip
cd pcre-8.10
./configure --prefix=/home/users/v_jiazhizhong/apache2/pcre
make && make install

tar -zxf httpd-2.4.20.tar.gz
cd httpd-2.4.20
./configure --prefix=/home/users/v_jiazhizhong/apache2 --with-apr=/home/users/v_jiazhizhong/apache2/apr --with-apr-util=/home/users/v_jiazhizhong/apache2/apr-util/ --with-pcre=/home/users/v_jiazhizhong/apache2/pcre
make && make install

编辑httpd.conf文件
vim httpd.conf
添加一下代码
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php

去php官网下载 php安装包

./configure --prefix=/usr/local/php \--with-apxs2=/usr/local/apache2/apxs \--enable-fpm \--enable-safe-mode \--enable-sigchild \--with-libxml-dir \--with-zlib \--enable-bcmath \--with-bz2 \--enable-calendar \--with-curl \--with-curlwrappers \--with-libxml-dir \--enable-exif \--with-pcre-dir \--enable-ftp \--with-gd \--with-jpeg-dir \--with-png-dir \--with-freetype-dir \--enable-gd-native-ttf \--with-gettext \--with-mhash \--enable-mbstring \--with-mcrypt \--with-mysql=mysqlnd \--with-mysqli=mysqlnd \--enable-pcntl \--with-pdo-mysql=mysqlnd \--enable-shmop \--enable-soap \--enable-sockets \--enable-sqlite-utf8 \--enable-sysvmsg \--enable-sysvsem \--enable-sysvshm \--enable-wddx \--with-xmlrpc \--with-xsl \--enable-zip \--with-zlib-dir \--with-pcre-dir  \--without-pear  \--with-openssl

make && make install