<!-- lang: shell -->
置顶处[lnmp编译安装][1]的php安装在/usr/local/路径下,本篇为lamp编译安装。apache与nginx共存,适用于apache的php安装在/usr/下
apache安装
依赖两个包apr,apr-util,资源都在apache官网下。
1.apr
tar xf apr-1.4.6.tar.bz2
cd apr-1.4.6
sudo ./configure --help | less (可以查看帮助文件)
sudo ./configure --prefix=/usr/local/apr (指定安装路径)
sudo make
sudo make install
2.apr-util
tar xf apr-util-1.5.2.tar.bz2
cd apr-util-1.5.2
sudo ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
(--prefix指定安装路径;--with-apr指定apr的安装路径,apr-util依赖于apr)
sudo make && make install
3.appache
开始编译
tar xf httpd-2.4.4.tar.bz2
cd httpd-2.4.4
sudo ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-cgid --enable-modules=most --enable-mods-shared=most --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-mpms-shared=all --with-mpm=event
--sysconfdir=/etc/httpd :指定配置文件安装位置
--enable-so :支持动态共享模块如果没有这个模块PHP将无法与apache结合工作
--enable-ssl :启用支持ssl
--enable-cgi :支持cgi
--enable-rewrite :支持URL重写
--with-zlib :压缩库,在互联网上传播时可节约带宽
--with-apr=/usr/local/apr :指定apr路径
--with-apr-util=/usr/local/apr-util :指定apr-util路径
--enable-mpms-shared=all 支持多道处理模块
--with-mpm=event 设定默认的模块
sudo make
sudo make install
启动apache
sudo /usr/local/apache/bin/apachectl start
mysql安装
与置顶的lnmp安装方法一致,为二进制安装。
php安装
依赖文件 :libbz2 libfreetype6-dev libltdl-dev libxml2-dev libpng12-dev libjpeg-dev libmcrypt-dev libcurl4-openssl-dev
编译配置:
sudo ./configure --prefix=/usr/php --with-config-file-path=/usr/php/etc --with-config-file-scan-dir=/usr/php/lib/php --with-mcrypt --with-jpeg-dir --with-png-dir --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql/bin/mysql_config --with-mysqli=/usr/local/mysql/bin/mysql_config --with-openssl --with-zlib --with-freetype-dir --enable-mbstring --enable-sockets --with-curl --with-gd --with-iconv-dir --with-pcre-dir --with-xmlrpc --enable-ftp --enable-gd-jis-conv --enable-gd-native-ttf --enable-soap --enable-mod-charset --enable-mysqlnd --enable-shmop --enable-zip --enable-static --enable-debug --enable-exif --enable-bcmath --enable-fpm --with-apxs2=/usr/local/apache/bin/apxs --with-bz2 --enable-maintainer-zts
sudo make
sudo make install
sudo cp php.ini-development /usr/php/etc/php.ini
sudo useradd --no-create-home --shell=/sbin/nologin www
cd /usr/php/etc
sudo cp php-fpm.conf.default php-fpm.conf
sudo vim php-fpm.conf (修改user=www group=www)
1.相关问题
apache启动
1. AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
http://www.javainmind.com/article-001/
有部分内容从jqhoudun的[博客][2]内截取,包括apr,apr-util,apache的编译安装,php的配置的部分编译配置。
转载于:https://my.oschina.net/lilclimate/blog/158490