linux编译安装LAMP
Linux安装Apache+MySQL+PHP
安装部分依赖
安装apr(可选)
# tar -xf apr-1.5.0.tar.bz2 # cd apr-1.5.0 #./configure --prefix=/usr/local/apr //指定其安装位置 # make && make install
安装apr-util
# tar -xf apr-util-1.5.3.tar.bz2 # cd apr-util-1.5.3 # ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr # make && make install
安装pcre(可选)
# tar -xf pcre-8.35.tar.gz # cd pcre-8.35 # ./configure --prefix=/usr/local/pcre # make && make install
编译安装apache
# tar -xf httpd2.4.9.tar.gz # cd <span style="font-family: Arial, Helvetica, sans-serif;">httpd2.4.9</span> # ./configure --prefix=/usr/local/apache --sysconfdir=/etc/httpd --enable-so --enable-ssl --enable-cgi --enable-rewrite --with-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most # make && make install编译过程中如果缺少其他依赖,可单独安装即可,安装过程如上面apr安装。
/usr/local/apache/bin/apachectl start浏览器输入http://IP/即可看到 It Works!
将apache加入service服务。
cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
编译安装MySQL
cd /usr/local/mysql chown -R mysql . chgrp -R mysql . scripts/mysql_install_db --user=mysql chown -R root .
</pre><h3>编译安装PHP</h3></div><pre name="code" class="html"># tar -xf php-5.5.12.tar.gz # cd <span style="font-family: Arial, Helvetica, sans-serif;">php-5.5.12</span> # ./configure --prefix=/usr/local/php5 --with-config-file-path=/usr/local/php5/etc --with-apxs2=/usr/local/apache/bin/apxs --enable-fastcgi --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --disable-debug --disable-ipv6 --with-iconv-dir --with-freetype-dir --with-jpeg-dir=/usr/local/jpeg --with-zlib --with-libxml-dir=/usr/local/libxml2 --enable-xml=/usr/local/libxml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local/curl --enable-mbregex --enable-fpm --enable-mbstring --with-gd --enable-gd-native-ttf --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap # make && make install编译过程中如果缺少其他依赖,可单独安装即可,安装过程如上面apr安装。
PHP与Apache整合
编辑apache配置文件httpd.conf,以apache支持php:
AddType
application
/x-httpd-php
.php
AddType
application
/x-httpd-php-source
.phps
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
添加测试页面:
测试结果:
集成xcache(可选)
安装:
# tar xf xcache-3.0.3.tar.gz # cd xcache-3.0.3 # /usr/local/php5/bin/phpize //phpize是用来安装php扩展模块的,通过phpize可以建立php的外挂模块,若你想在原来编译好的php中加入memcached或者ImageMagick等扩展模块,就需要使用phpize # ./configure --enable=xcache --with-php-config=/usr/local/php5/bin/php-config [root@Spg-RedHat xcache-3.1.0]#make && make install Installing shared extensions: /usr/local/php5/lib/php/extensions/no-debug-zts-20121212/
集成:修改php.ini文件,加入如下内容:
[xcache-common] extension = <span style="white-space: nowrap; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;">/usr/local/php5/lib/php/extensions/no-debug-zts-20121212</span><span style="white-space: nowrap; font-family: Consolas, 'Bitstream Vera Sans Mono', 'Courier New', Courier, monospace;">/xcache.so</span> [xcache.admin] xcache.admin.enable_auth = On xcache.admin.user = "admin" xcache.admin.pass = "6a0194f9707fa832ece6f5b66a25567e" #echo -n "youp-assword" |md5sum |awk '{print $1}' [xcache] xcache.shm_scheme = "mmap" xcache.size = 128M xcache.count = 1 xcache.slots = 8K xcache.ttl = 0 xcache.gc_interval = 0 xcache.var_size = 0M xcache.var_count = 1 xcache.var_slots = 8K xcache.var_ttl = 0 xcache.var_maxttl = 0 xcache.var_gc_interval = 300 xcache.test = Off xcache.readonly_protection = Off xcache.mmap_path = "/dev/zero" xcache.coredump_directory = "" xcache.cacher = On xcache.stat = On xcache.optimizer = Off [xcache.coverager] xcache.coverager = Off xcache.coveragedump_directory = ""注意:其中的extension值“/usr/local/php5/lib/php/extensions/no-debug-zts-20121212/”为前面make install的结果。
pass自行生成,为明文MD5加密结果。
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。