12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
ADADADADAD
mysql数据库 时间:2024-12-03 10:27:40
作者:文/会员上传
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
12-09
9.1、PHP与httpd的结合工作方式常见PHP开源软件: 论坛:phpwind、discuz 、phpbb 博客系统:wordpress 门户站点:drupal、xooms 数据库:phpMyAdmin、Workbench、MySQL Front、Navic
以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。
9.1、PHP与httpd的结合工作方式
常见PHP开源软件:
论坛:phpwind、discuz 、phpbb
博客系统:wordpress
门户站点:drupal、xooms
数据库:phpMyAdmin、Workbench、MySQL Front、Navicat for MySQL、Toad
CMS(Content Management System)内容管理系统:Drupal、joomla
PHP与httpd的结合方式:
Module作为模块,需要时加载:
prefork: 一个请求用一个进程处理,稳定性好、大并发场景下消耗资源较多;事先创建进程,按需维 持适当的进程,模块块设计,核心比较小,各种功能都模块添加(包括php),支持运行配置,支持单独编译模块,支持多种方式的虚拟主机配置。
worker:一个进程多个线程,一个线程响应一个请求
event:一个线程响应多个请求,事件驱动,主要目的在于实现单线程响应多个请求
Cgi(Common gateway interface):通用网关接口,为HTTP服务器与其他机器上的程序服务通信的一种交流工具。(CGI程序必须运行在网络服务器,每次HTTP服务遇到动态程序时都需要成新启动解析器)
Fastcgi,可伸缩的,高速的在HTTP服务器和动态脚本语言间通信的接口,优点是把动态语言和HTTP服务器相分离。其主要行为是将CGI解释器进程保持在内存中并因此获得较高的性能。CGI解释器的反复加载是CGI性能低下的主要原因,如果CGI解释器保持在内存中并接受FastCGI进程管理器调度,则可以提供良好的性能、伸缩性、Fail- Over特性等等。
LAMP配置顺序:httpd --> MySQL --> php --> XCache(缓存器/优化器)
rpm格式配置lamp
#yum-yinstallhttpdphpphp-mysqlmysql-servermysqlphp-mcrypt
9.2、编译安装LAMP
软件版本:
apacge:httpd-2.4.25.tar.gz
依赖包:apr-1.5.2.tar.gz apr-util-1.5.4.tar.gz
mysql:mysql-5.5.55-linux2.6-x86_64.tar.gz
php: php-5.6.30-src.zip
相关软件下载:
#wgethttp://mirrors.hust.edu.cn/apache//httpd/httpd-2.4.25.tar.gz#wgethttp://mirrors.hust.edu.cn/apache//apr/apr-1.5.2.tar.gz#wgethttp://mirrors.hust.edu.cn/apache//apr/apr-util-1.5.4.tar.gz#wgethttp://ftp.ntu.edu.tw/pub/MySQL/Downloads/MySQL-5.5/mysql-5.5.55-linux2.6-x86_64.tar.gz#wgethttp://cn2.php.net/distributions/php-5.6.30.tar.gz
1、安装apache
[root@mylinuxapp]#tarxfapr-1.5.2.tar.gz[root@mylinuxapp]#cdapr-1.5.2[root@mylinuxapr-1.5.2]##./configure--prefix=/usr/local/apr[root@mylinuxapr-1.5.2]##make&&makeinstall[root@mylinuxapp]#tarxfapr-util-1.5.4.tar.gz[root@mylinuxapp]#cdapr-util-1.5.4[root@mylinuxapr-util-1.5.4]./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr/[root@mylinuxapr-util-1.5.4]make&&makeinstall[root@mylinuxhome]#yuminstallpcre-devel-y[root@mylinuxapp]#tarxfhttpd-2.4.25.tar.gz[root@mylinuxapp]#cdhttpd-2.4.25[root@mylinuxhttpd-2.4.25]#./configure--prefix=/usr/local/apache--sysconfdir=/etc/httpd24--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--enable-mpms-shared=all--with-mpm=event[root@mylinuxhttpd-2.4.25]#make&&makeinstall[root@mylinuxhttpd24]#vim/etc/httpd24/httpd.conf#修改配置文件PidFile"/var/run/httpd.pid"#添加该行ServerName127.0.0.1:80#修改服务名称#提供服务脚本[root@mylinuxhttpd24]#cp/home/app/httpd-2.4.25/build/rpm/httpd.init/etc/rc.d/init.d/httpd[root@mylinuxinit.d]#vim/etc/rc.d/init.d/httpd#修改相关参数CONFFILE=/etc/httpd24/httpd.confapachectl=/usr/local/apache/bin/apachectlhttpd=${HTTPD-/usr/local/apache/bin/httpd}pidfile=${PIDFILE-/var/run/${prog}.pid}lockfile=${LOCKFILE-/var/lock/subsys/${prog}}RETVAL=0prog=httpd[root@mylinuxinit.d]#chmod+x/etc/rc.d/init.d/httpd#为此脚本赋予执行权限[root@mylinuxinit.d]#chkconfig--addhttpd#加入服务列表[root@mylinuxinit.d]#servicehttpdstart#启动测试Startinghttpd:[OK]
2、通用二进制格式安装MySQL
[root@mylinuxapp]#tarxfmysql-5.5.55-linux2.6-x86_64.tar.gz[root@mylinuxapp]#ln-sv/home/app/mysql-5.5.55-linux2.6-x86_64/usr/local/mysql`/usr/local/mysql'->`/home/app/mysql-5.5.55-linux2.6-x86_64'[root@mylinuxapp]#cdmysql[root@mylinuxmysql]#chown-Rroot:mysql.[root@mylinuxmysql]#scripts/mysql_install_db--user=mysql#初始化[root@mylinuxmysql]#cpsupport-files/my-large.cnf/etc/my.cnf#提供配置文件[root@mylinuxmysql]#cpsupport-files/mysql.server/etc/rc.d/init.d/mysqld#服务脚本[root@mylinuxmysql]#servicemysqldstart#启动测试StartingMySQL..SUCCESS![root@mylinuxprofile.d]#vim/etc/mysql.sh#添加环境变量[root@mylinuxprofile.d]#sourcemysql.sh[root@mylinuxprofile.d]#mysqlWelcometotheMySQLmonitor.Commandsendwith;or\g.YourMySQLconnectionidis1Serverversion:5.5.55-logMySQLCommunityServer(GPL)Copyright(c)2000,2017,Oracleand/oritsaffiliates.Allrightsreserved.OracleisaregisteredtrademarkofOracleCorporationand/oritsaffiliates.Othernamesmaybetrademarksoftheirrespectiveowners.Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.mysql>quitBye[root@mylinuxprofile.d]#
3、安装PHP
#yum-ygroupinstall"DesktopPlatformDevelopment"#解决依赖关系#yum-yinstallbzip2-devellibmcrypt-devel[root@mylinuxapp]#tarxfphp-5.6.30.tar.gz[root@mylinuxapp]#cdphp-5.6.30[root@mylinuxphp-5.6.30]#./configure--prefix=/usr/local/php--with-mysql=/usr/local/mysql--with-openssl--with-mysqli=/usr/local/mysql/bin/mysql_config--enable-mbstring--with-freetype-dir--with-jpeg-dir--with-png-dir--with-zlib--with-libxml-dir=/usr--enable-xml--enable-sockets--with-apxs2=/usr/local/apache/bin/apxs--with-mcrypt--with-config-file-path=/etc--with-config-file-scan-dir=/etc/php.d--with-bz2--enable-maintainer-zts[root@mylinuxphp-5.6.30]#make[root@mylinuxphp-5.6.30]#maketest[root@mylinuxphp-5.6.30]#makeinstall[root@mylinuxphp-5.6.30]#cpphp.ini-production/etc/php.ini#提供配置文件
4、修改apache相关配置
#vim/etc/httpd/httpd.confAddTypeapplication/x-httpd-php.php#添加两行AddTypeapplication/x-httpd-php-source.phps...<IfModuledir_module>DirectoryIndexindex.phpindex.html#修改该行</IfModule>
5、测试
[root@mylinuxphp-5.6.30]#servicehttpdrestartStoppinghttpd:[OK]Startinghttpd:[OK][root@mylinuxhtdocs]#vim/usr/local/apache/htdocs/123.php<?php$link=mysql_connect('127.0.0.1');if($link)echo"Success...";elseecho"Failure...";mysql_close();?>[root@mylinuxhtdocs]#vim/usr/local/apache/htdocs/index..php<?phpphpinfo()?>
11-20
11-19
11-20
11-20
11-20
11-19
11-20
11-20
11-19
11-20
11-19
11-19
11-19
11-19
11-19
11-19