apache解析php编译安装配置(LAMP)

上传人:tia****nde 文档编号:36842074 上传时间:2018-04-03 格式:DOC 页数:10 大小:50.50KB
返回 下载 相关 举报
apache解析php编译安装配置(LAMP)_第1页
第1页 / 共10页
apache解析php编译安装配置(LAMP)_第2页
第2页 / 共10页
apache解析php编译安装配置(LAMP)_第3页
第3页 / 共10页
apache解析php编译安装配置(LAMP)_第4页
第4页 / 共10页
apache解析php编译安装配置(LAMP)_第5页
第5页 / 共10页
点击查看更多>>
资源描述

《apache解析php编译安装配置(LAMP)》由会员分享,可在线阅读,更多相关《apache解析php编译安装配置(LAMP)(10页珍藏版)》请在金锄头文库上搜索。

1、Apache+mysql+php+zendApache+mysql+php+zend 搭建搭建 webweb 服务器服务器环境:VMware Workstation Centos5.5 首先用 yum 卸载掉系统自安装的 httpd,mysql,php 软件需要: eaccelerator-0.9.6.1.tar.bz2 gd-2.0.33.tar.gz httpd-2.2.9.tar.gz mysql-5.5.11.tar.gz php-5.2.8.tar.gz ZendOptimizer-3.3.0-linux-glibc21-i386.tar.gz nginx-1.0.0.tar.gz

2、pcre-8.0.tar.gz一、mysql 的安装 解压缩后 安装步骤为: #cmake . #make #make install 安装后的目录/usr/local/mysql/ 建立 mysql 用户和组 #useradd mysql 这里要给 mysql 安装目录以 mysql 用户和组权限: #cd /usr/local/mysql/ #chown -R mysql:mysql . #/usr/local/mysql/bin/mysql_install_db -user=mysql # chown -R root.root /usr/local/ mysql/ 启动 mysql: #

3、cd /usr/local/mysql/bin #./mysqld_safe & 设置 root 密码: #./mysqladmin -u root password “mysql”(这里是我的 mysql 密码) 登陆 mysql: #./mysql u root -p Mysql 安装到/usr/local/mysql 添加到系统服务,并开机启动 #cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld (复 制自带脚本到启动目录) #chmod 755 /etc/rc.d/init.d/mysqld (

4、加执行权限) #chkconfig -add mysqld (添加到 chkconfig 列表) #chkconfig -level 2345 mysqld on (在 2345 级别开机启动) 这样设置后,就可以用 service 管理 mysqld 服务的启动、关闭和重启。 添加库文件搜索路径 #echo “/usr/local/mysql/lib/“ /etc/ld.so.conf (添加到 ld.so.conf)#ldconfig (载入修改) #ldconfig v (查看所有搜索路径) #echo “export PATH=$PATH:/usr/local/mysql/bin/“

5、/.bashrc (添加环 境变量到家目录,这对本用户有效) #source /.bashrc (使修改立即生效) 二、安装 GD # tar -jxvf gd-2.0.33.tar.gz # cd gd-2.0.33 # ./configure -prefix=/usr/local/www/gd -with-png -with-freetype -with- jpeg -with-zlib -with-fontconfig 注意这里配置完成后,最后面会打印出来一个文字框,有些 no 状态的,这时候可以用 yum 来安装相应的库文件,可以参考下面的文件是否安装,安装问这些库文件,再来重新 co

6、nfigure,直到所有的项都问 yes 状态(即使为 no,configure 也会成功) 。 bzip2-devel zlib-devel libjpeg-devel libpng-devel libtiff-devel freetype- devel openssl-devel libxml2-devel gettext-devel fontconfig-devel # make #如果 GD 报错:configure.ac:64: warning: macro AM_ICONV not found in library 就 make clean 一下,然后再 make # make i

7、nstall 三、安装 apache # groupadd http # useradd -g http -s /sbin/nologin -M http # tar -zxvf httpd-2.2.9.tar.gz # cd httpd-2.2.9.tar.gz 2.2.x 版本的 apache 是自带了 apr 和 apr-util 的,不用下载,直接编译,注意编译要觉 得安装路径,否则编译 apache 时候会找不到 apr 和 apr-util 的 # cd srclib/apr # ./configure -prefix=/usr/local/apr -enable-threads

8、-enable-other-child - -enable-static # make & make install # cd ./apr-util # ./configure -prefix=/usr/local/apr-util -with-apr=/usr/local/apr # make & make install # cd ./. # ./configure -prefix=/usr/local/www/apache -enable-so -enable-rewrite - -with-apr=/usr/local/apr -with-apr-util=/usr/local/apr

9、-util # make # make install 添加到自启动 # cp /usr/local/www/apache/bin/apachectl /etc/rc.d/init.d/httpd 然后 vi /etc/rc.d/init.d/httpd 添加(#!/bin/sh 下面) #chkconfig:2345 70 30 #description: Activates/Deactivates Apache Web Server #processname: httpd关键是 chkconfig: 2345 70 30 这一行,第一个数字 2345 表示让 apache 在 2345 这

10、四个级别都自动运行;第二个数字 70 表示进程启动的优先级;第三个数字 30 表示进 程停止的优先级。修改保存之后执行 /sbin/chkconfig 就自动在各个级别的 rc*.d 中增 加 httpd 的 link 。要查看 chkconfig 是否 reset 正确,通过命令 /sbin/chkconfig -list httpd 就可以查看当前 httpd service 被配置在哪几个运行级别自启动。 关于 chkconfig: 2345 70 30 这一行中第二和第三个数字设置时需要注意的地方: 1、优先级的数字越大,表示越靠后,也就是越不优先; 2、一般把数据库服务器的启动优先级

11、高于依赖于该数据库的应用; 3、不依赖其它服务的服务优先启动,依赖于其它服务的服务要后启动; 4、停止时的优先级顺序刚好同启动时相反,也就是说依赖于其它服务的服务要先关闭; 被别的服务依赖的服务要后关闭。最后,运行 chkconfig 把 Apache 添加到系统的启动服务组里面: # chkconfig -add httpd # chkconfig httpd on配置 apache #vi /usr/local/www/apache/conf/httpd.conf (1)找到 DocumentRoot “/usr/local/www/apache/htdocs“ 修改为:DocumentR

12、oot “/var/www/html“ (2)找到Options FollowSymLinks AllowOverride None Order deny,allow Deny from all /这句改为 Allow from all(3)找到 修改为: (4)找到 Options Indexes FollowSymLinks /这行注释掉,禁止目录列表 (5)找到User daemon /改为 http Group daemon /改为 http四、安装 php # tar -jxvf php-5.2.17.tar.bz2# cd php-5.2.17 # ./configure -pre

13、fix=/usr/local/www/php -with- apxs2=/usr/local/www/apache/bin/apxs -with-mysql=/usr/local/mysql - with-gd=/usr/local/www/gd -with-config-file-path=/usr/local/www/php - enable-mbstring=all -enable-xml -disable-rpath -enable-bcmath - enable-shmop -enable-sysvsem -enable-inline-optimization -enable- mb

14、regex -with-zlib -enable-sockets -enable-soap -enable-exif -with- zlib-dir -with-bz2 -with-libxml-dir # make # make install # cp php.ini-dist /usr/local/www/php/php.ini整合 apache 与 php # vi /usr/local/www/apache/conf/httpd.conf 找到 AddType application/x-gzip .gz .tgz 在其下加以下内容 AddType application/x-htt

15、pd-php .php 设置 WEB 默认文件 DirectoryIndex index.html 改成: DirectoryIndex index.php index.html index.htm 保存退出 #/etc/init.d/httpd restart 然后在目录/var/www/html 中建一个 index.php 用来测试 php 情况: #vim index.php保存退出 重启 apache 即可 五、安装 php 加速程序 1、安装 eaccelerator 加速软件 eaccelerator 是 php 的加速软件,使用后 php 的执行效率会有很大幅度的提升。 # t

16、ar jxvf eaccelerator-0.9.6.1.tar.bz2 # cd eaccelerator-0.9.6.1 # /usr/local/www/php/bin/phpize # ./configure -enable-eaccelerator=shared -with-php- config=/usr/local/www/php/bin/php-config # make # make install make install 后会看到屏幕提示的 eaccelerator.so 所在的目录,php5.2.x 系列是在 /usr/local/www/php/lib/php/extensions/no-debug-non-zts-20060613 修改 php.ini # vi /us

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 中学教育 > 试题/考题

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号