Linux下mysql+php+apache环境的搭建.doc

上传人:飞****2 文档编号:60097516 上传时间:2022-11-13 格式:DOC 页数:8 大小:30KB
返回 下载 相关 举报
Linux下mysql+php+apache环境的搭建.doc_第1页
第1页 / 共8页
Linux下mysql+php+apache环境的搭建.doc_第2页
第2页 / 共8页
点击查看更多>>
资源描述

《Linux下mysql+php+apache环境的搭建.doc》由会员分享,可在线阅读,更多相关《Linux下mysql+php+apache环境的搭建.doc(8页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、 Linux下mysql+php+apache环境的搭建前言:本文主要介绍linux环境下mysql+php+apache服务器的安装配置,Linux环境的搭建安装步骤:(系统要求:Linux 2.6+ 内核,本文中的Linux操作系统为CentOS6.2)获取相关开源程序:1. 【适用CentOS操作系统】利用CentOS Linux系统自带的yum命令安装、升级所需的程序库(RedHat等其他Linux发行版可从安装光盘中找到这些程序库的RPM包,进行安装):sudo -sLANG=Cyum -y install gcc gcc-c+ cmake autoconf libjpeg libj

2、peg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap

3、 openldap-clients openldap-servers2. 【适用CentOS、RedHat及其它Linux操作系统】下载程序源码包: 所有源码都下载在:/usr/local/srcapache、mysql、php安装路径设定在:/usr/local/webserver一、 安装PHP 5.4.3(FastCGI模式)注意:分布式安装时,同样要在php服务器中安装对应的mysql扩展。首先卸载系统自带的mysql和php及apache rpm -qa | grep * rpm -e -nodeps *1. 编译安装apache2和PHP 5.4.3所需的支持库:Cd /usr/l

4、ocal/srctar zxvf apr-1.4.6.tar.gzcd apr-1.4.6./configure -prefix=/usr/local/aprmake & make installcd ./tar zxvf apr-util-1.4.1.tar.gzcd apr-util-1.4.1./configure -prefix=/usr/local/apr-util -with-apr=/usr/local/aprmake & make installcd ./ tar zxvf pcre-8.30.tar.gzcd pcre-8.30./configure -prefix=/usr

5、/local/pcremake & make installcd ./tar zxvf libiconv-1.13.1.tar.gzcd libiconv-1.13.1/./configure -prefix=/usr/localmakemake installcd ./tar zxvf libmcrypt-2.5.8.tar.gzcd libmcrypt-2.5.8/./configuremakemake installldconfigcd libltdl/./configure -enable-ltdl-installmakemake installcd ././tar zxvf mhas

6、h-0.9.9.9.tar.gzcd mhash-0.9.9.9/./configuremakemake installcd ./ln -s /usr/local/lib/libmcrypt.la /usr/lib/libmcrypt.laln -s /usr/local/lib/libmcrypt.so /usr/lib/libmcrypt.soln -s /usr/local/lib/libmcrypt.so.4 /usr/lib/libmcrypt.so.4ln -s /usr/local/lib/libmcrypt.so.4.4.8 /usr/lib/libmcrypt.so.4.4.

7、8ln -s /usr/local/bin/libmcrypt-config /usr/bin/libmcrypt-configln -s /usr/local/lib/libmhash.a /usr/lib/libmhash.aln -s /usr/local/lib/libmhash.la /usr/lib/libmhash.laln -s /usr/local/lib/libmhash.so /usr/lib/libmhash.soln -s /usr/local/lib/libmhash.so.2 /usr/lib/libmhash.so.2ln -s /usr/local/lib/l

8、ibmhash.so.2.0.1 /usr/lib/libmhash.so.2.0.1tar zxvf mcrypt-2.6.8.tar.gzcd mcrypt-2.6.8/ldconfig./configuremakemake installcd ./2. 编译安装apache2方式如下groupadd wwwuseradd -g www wwwtar zxvf httpd-2.4.2.tar.gzcd httpd-2.4.2./configure -prefix=/usr/local/webserver/apache2 -enable-module=so -enable-rewrite -

9、enable-ssl -enable-cgi -enable-mods-shared=all -with-apr=/usr/local/apr -with-apr-util=/usr/local/apr-util -with-pcre=/usr/local/pcremake & make installcd ./ cp /usr/local/webserver/apache2/bin/apachectl /etc/init.d/httpd修改文件 /etc/init.d/httpd在第一行下面添加 # chkconfig: - 85 15 # description: Apachechkcon

10、fig -add httpdchkconfig httpd on编译安装MySQL 5.5.24方式如下groupadd mysqluseradd -g mysql mysqltar zxvf mysql-5.5.24.tar.gzcd mysql-5.5.24cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/webserver/mysql -DMYSQL_DATADIR=/usr/local/webserver/mysql/data -DDEFAULT_CHARSET:STRING=utf8 -DDEFAULT_COLLATION:STRING=utf8_g

11、eneral_ci -DENABLED_LOCAL_INFILE:BOOL=ON -DWITH_SSL:STRING=yesmake & make install编译安装之后:chmod +w /usr/local/webserver/mysqlchown -R mysql:mysql /usr/local/webserver/mysqlcd ./附:以下为附加步骤,如果你想在这台服务器上运行MySQL数据库,则执行以下两步。如果你只是希望让PHP支持MySQL扩展库,能够连接其他服务器上的MySQL数据库,那么,以下两步无需执行。、创建MySQL数据库存放目录mkdir -p /data0/

12、mysql/3306/data/chown -R mysql:mysql /data0/mysql/、以mysql用户帐号的身份建立数据表:/usr/local/webserver/mysql/scripts/mysql_install_db -basedir=/usr/local/webserver/mysql -datadir=/data0/mysql/3306/data -user=mysql、创建f配置文件mysql启动文件:cp /usr/local/webserver/mysql/support-files/my-f /etc/fcp /usr/local/webserver/my

13、sql/support-files/mysql.server /etc/init.d/mysqld修改mysql脚本文件中的datadir路径basedir=/usr/local/webserver/mysqldatadir=/data0/mysql/3306/data、启动MySQL:chkconfig -add mysqldchkconfig mysqld onservice mysqld start、设置mysql的root用户和密码:su mysql/usr/local/webserver/mysql/bin/mysqladmin -uroot password su root输入当前

14、用户的密码回到root用户、(可选)停止MySQL:service mysqld stop3. 编译安装PHP(FastCGI模式)cp /usr/local/webserver/mysql/lib/libmysqlclient.so.18 /usr/libtar zxvf php-5.4.3.tar.gzcd php-5.4.3/./configure -prefix=/usr/local/webserver/php -with-config-file-path=/usr/local/webserver/php/etc -with-mysql=/usr/local/webserver/mys

15、ql -with-mysqli=/usr/local/webserver/mysql/bin/mysql_config -with-iconv-dir=/usr/local -with-freetype-dir -with-jpeg-dir -with-png-dir -with-zlib -with-libxml-dir=/usr -enable-xml -disable-rpath -enable-bcmath -enable-shmop -enable-sysvsem -enable-inline-optimization -with-curl -with-curlwrappers -e

16、nable-mbregex -enable-fpm -enable-mbstring -with-mcrypt -with-gd -enable-gd-native-ttf -with-openssl -with-mhash -enable-pcntl -enable-sockets -with-ldap -with-ldap-sasl -with-xmlrpc -enable-zip -enable-soap -without-pear -with-apxs2=/usr/local/webserver/apache2/bin/apxsmake ZEND_EXTRA_LIBS=-liconvm

17、ake installcp php.ini-production /usr/local/webserver/php/etc/php.inicd /usr/local/webserver/php/etccp php-fpm.conf.default php-fpm.conf修改php-fpm.confuser = wwwgroup = www让apache支持PHP修改httpd.conf#LoadModule php5_module modules/libphp5.so 去掉#添加AddType application/x-httpd-php .phpPHP伪静态设置:修改httpd.conf

18、中#LoadModule rewrite_module modules/mod_rewrite.so 去掉#查找AllowOverride None 修改为 AllowOverride all开启PHP短标记:将php.ini 里的short_open_tag = off 改成 short_open_tag = On优化Linux内核参数vi /etc/sysctl.conf在末尾增加以下内容:引用# Addnet.ipv4.tcp_max_syn_backlog = 65536dev_max_backlog =32768net.core.somaxconn = 32768net.core.w

19、mem_default = net.core.rmem_default = net.core.rmem_max = net.core.wmem_max = net.ipv4.tcp_timestamps = 0net.ipv4.tcp_synack_retries = 2net.ipv4.tcp_syn_retries = 2net.ipv4.tcp_tw_recycle = 1#net.ipv4.tcp_tw_len = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_mem = net.ipv4.tcp_max_orphans = #net.ipv4.tcp_fin_timeout = 30#net.ipv4.tcp_keepalive_time = 120net.ipv4.ip_local_port_range = 102465535使配置立即生效:/sbin/sysctl -p

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

当前位置:首页 > 教育专区 > 教案示例

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁