|
安装部分依赖安装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安装。
如果提示apr相关错误,将编译语句中--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util 参数去掉即可,因为Apache默认包含了自己的apr相关东西。
启动http
- /usr/local/apache/bin/apachectl start
浏览器输入http://IP/即可看到 It Works!
将apache加入service服务。
- cp /usr/local/apache/bin/apachectl /etc/init.d/httpd
此时可通过service httpd start/stop启动关闭http服务
编译安装MySQLMySQL编译安装过程见此处http://blog.iyunv.com/zqtsx/article/details/9378703,这里不再描述。
注意,上面的安装有部分修改权限的错误,其中描述的如下部分不要执行:
- 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目录:
# cp php.ini-production /usr/local/php5/etc/php.ini
PHP与Apache整合编辑apache配置文件httpd.conf,以apache支持php:
首先要在apache配置文件中定义,使apache能够处理php结尾的文件 ,全文查找AddType字段,添加一下内容
[iyunv@Spg-RedHat htdocs]# vi /usr/local/apache/conf/httpd.conf
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
找到DirectoryIndex,添加index.php:
DirectoryIndex index.php index.html
<Directory /data/bbs/admin>
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>
添加测试页面:[iyunv@Spg-RedHat htdocs]# vim /usr/local/apache/htdocs/index.php
编辑加入:
<?
phpinfo();
?>
重启http:
service httpd stop
service httpd start
测试结果:
至此,PHP安装成功;
集成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
- [iyunv@Spg-RedHat xcache-3.1.0]#make && make install
- Installing shared extensions: /usr/local/php5/lib/php/extensions/no-debug-zts-20121212/
集成:修改php.ini文件,加入如下内容:
[iyunv@Spg-RedHat xcache-3.1.0]# vim /usr/local/php5/etc/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加密结果。
网上也有通过将xcache.ini文件拷贝到/etc/php.d/目录下进行集成的方法,但是我尝试未成功。有兴趣可自行尝试。
再重启Apache,在phpinfo页面即可看到xcache相关配置,如下图所示:
结束:没接触过php,首次安装php,痛苦的过程。
|
|