Linux-LAMP平台搭建详解


安装Apache2.4:

 首先从  http://httpd.apache.org/download.cgi#apache24 
下载apache源码包httpd-2.4.4.tar.gz 
  http://apr.apache.org/download.cgi  下载 
apr-1.4.6.tar.gzapr-util-1.5.1.tar.gz
   http://sourceforge.net/projects/pcre/files/pcre/8.32/  下载 
pcre-8.32.tar.gz 
打开终端切到root su 输入密码 
先装gccmake
yum -y install gcc 
yum -y install make 
yum -y install gcc-c++  没有这个gcc-c++一会编译不prce 切到下载好的源码包目录,本人是~/Download 
安装apr:
tar -zvxf apr-1.4.6.tar.gz 
cd apr-1.4.6 
./configure --prefix=/usr/local/apr 
make && make install 
安装apr-util 
tar -zvxf apr-util-1.5.1.tar.gz 
cd apr-util-1.5.1 
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr 
make && make install 
安装pcre 
tar -zvxf pcre-8.32.tar.gz 
cd pcre-8.32 
./configure 
make && make install 
安装apache 一定要先装上面那三个不然编译不了 
tar -zvxf httpd-2.4.4.tar.gz 
cd httpd-2.4.4 
./configure --prefix=/usr/local/apache --with-apr-util=/usr/local/apr-util 
make && make install 
启动apache 
/usr/local/apache/bin/httpd 
安装PHP5.5 
yum -y install libxml2-devel 不装这个编译不了PHP5.5 
www.php.net下载PHP5.5 本人下载的是php-5.5.0.tar.gz 切到下载目录
 
 

安装依赖

# yum install gcc bison bison-devel zlib-devel libmcrypt-devel mcrypt mhash-devel openssl-devel libxml2-devel libcurl-devel bzip2-devel readline-devel libedit-devel perl

创建 www 用户

# groupadd www

# useradd -g www -s /sbin/nologin -M www

 tar -zvxf php-5.5.0.tar.gz # ./configure \
--prefix=/usr/local/php \

--with-apxs2=/usr/local/apache/bin/apxs \

--with-config-file-path=/etc \

--enable-inline-optimization \

--disable-debug \

--disable-rpath \

--enable-shared \

--enable-opcache \

--enable-fpm \

--with-fpm-user=www \

--with-fpm-group=www \

--with-mysql=mysqlnd \

--with-mysqli=mysqlnd \

--with-pdo-mysql=mysqlnd \

--with-gettext \

--enable-mbstring \

--with-iconv \

--with-mcrypt \

--with-mhash \

--with-openssl \

--enable-bcmath \

--enable-soap \

--with-libxml-dir \

--enable-pcntl \

--enable-shmop \

--enable-sysvmsg \

--enable-sysvsem \

--enable-sysvshm \

--enable-sockets \

--with-curl \

--with-zlib \

--enable-zip \

--with-bz2 \

--with-readline \

--without-sqlite3 \

--without-pdo-sqlite \

--with-pear

参数说明:

""" 安装路径 """

--prefix=/usr/local/php \

""" php.ini 配置文件路径 """

--with-config-file-path=/etc \

""" 优化选项 """

--enable-inline-optimization \

--disable-debug \

--disable-rpath \

--enable-shared \

""" 启用 opcache,默认为 ZendOptimizer+(ZendOpcache) """

--enable-opcache \

""" FPM """

--enable-fpm \

--with-fpm-user=www \

--with-fpm-group=www \

""" MySQL """

--with-mysql=mysqlnd \

--with-mysqli=mysqlnd \

--with-pdo-mysql=mysqlnd \

""" 国际化与字符编码支持 """

--with-gettext \

--enable-mbstring \

--with-iconv \

""" 加密扩展 """

--with-mcrypt \

--with-mhash \

--with-openssl \

""" 数学扩展 """

--enable-bcmath \

""" Web 服务,soap 依赖 libxml """

--enable-soap \

--with-libxml-dir \

""" 进程,信号及内存 """

--enable-pcntl \

--enable-shmop \

--enable-sysvmsg \

--enable-sysvsem \

--enable-sysvshm \

""" socket & curl """

--enable-sockets \

--with-curl \

""" 压缩与归档 """

--with-zlib \

--enable-zip \

--with-bz2 \

""" GNU Readline 命令行快捷键绑定 """

--with-readline \

""" 禁用 SQLite 支持扩展 """

--without-sqlite3 \

--without-pdo-sqlite \

""" 更多 PHP 扩展与应用库 """

--with-pear

如果你的 Web Server 使用的 Apache 请添加类似:--with-apxs2=/usr/local/apache/bin/apxs 参数。

Make –j4      \\效率高

make install

配置 PHP

配置文件

# cp php.ini-development /etc/php.ini

php-fpm 服务

# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
# cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
# chmod +x /etc/init.d/php-fpm

启动 php-fpm

# service php-fpm start
Starting php-fpm  done

php-fpm 可用参数 start|stop|force-quit|restart|reload|status


编辑apache配置文件:
vim /usr/local/apache/conf/http.conf
AddType application/x-httpd-php .php 

 DirectoryIndex index.html index.php index.php3
保存退出:wq
重启Apache
/usr/local/apache/bin/apachectl restart

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30029851/viewspace-1339715/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/30029851/viewspace-1339715/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值