设为首页 收藏本站
查看: 1398|回复: 0

[经验分享] MYSQL+APACHE+PHP (动态安装apache实验中)

[复制链接]

尚未签到

发表于 2018-11-27 07:13:43 | 显示全部楼层 |阅读模式
系统 :LINUX5.4
目的: MYSQL+APACHE+PHP 实验
软件: mysql-5.1.47.tar.gz
       httpd-2.2.15.tar.gz
       php-5.2.13.tar.gz

一、安装MYSQL
1、    创建mysql用户和组
[root@dns redhat]#chmod  777  mysql-5.1.47.tar.gz
[root@dns redhat]tar –zxvf mysql-5.1.47.tar.gz
[root@dns redhat]#cd mysql-5.1.47
[root@dns redhat]#groupadd mysql
[root@dns redhat]#useradd –g mysql –s /sbin/nologin mysql


2、开始安装mysql
[root@mysql51 mysql-5.1.47]#./configure
--prefix=/usr/local/mysql         #mysql安装目录
--with-charset=utf8               #使用UTF8字符集
--with-collation=utf8_general_ci  #校对规则
--with-extra-charsets=complex     #支持所有的扩展字符集
--with-big-tables                 #启用大表
--with-plugins=partition          #大表分割
--enable-thread-safe-client       #让客户端支持线程
--enable-assembler                #允许汇编模式,(优化性能)
--enable-local-infile             #支持从本地导入mysql
--with-mysqld-ldflags=-all-static
--with-client-ldflags=-all-static
# 以纯静态方式编译服务端和客户端   ( 优化性能)
--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
#使用unix套接字链接提高 7.5%性能,所以在windows下mysql性能肯定不如unix下面
[root@dns redhat]#make
[root@dns redhat]#make install
[root@mysql51 mysql-5.1.47]#
cp support-files/my-large.cnf /etc/my.cnf

[root@mysql51 mysql-5.1.47]# cd /usr/local/mysql/
[root@mysql51 mysql]#bin/mysql_install_db --user=mysql
[root@mysql51 mysql]#chown -R root .
[root@mysql51 mysql]#chown -R mysql var
[root@mysql51 mysql]#chgrp -R mysql .
[root@mysql51 mysql]# bin/mysqld_safe --user=mysql &
[1] 1740
[root@mysql51 mysql]# 100610 21:22:15 mysqld_safe Logging to '/usr/local/mysql/var/mysql51.com.err'.
100610 21:22:16 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var

3、开机启动mysql
[root@mysql51 mysql]# cp share/mysql/mysql.server /etc/init.d/mysqld
[root@mysql51 mysql]# chkconfig --add mysqld
[root@mysql51 mysql]#  cd /etc/init.d/
[root@mysql51 init.d]# chmod +x mysqld
[root@mysql51 init.d]# chkconfig --list mysqld
[root@mysql51 init.d]# chkconfig --level 35 mysqld on
[root@mysql51 init.d]# service mysqld start
Starting MySQL                                             [确定]
[root@mysql51 init.d]# cp /usr/local/mysql/bin/* /sbin/
[root@mysql51 init.d]# mysqladmin -u root -h localhost password 'mysql'
[root@dns init.d]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 5.0.22-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>show databases;

mysql> grant all privileges on *.* to root@'%' identified by 'aa123456' with grant option;
Query OK, 0 rows affected (0.00 sec)
从你的NVCAT链接试试吧
到这里基本上已经安装成功了

二、安装APR
[root@mysql51 down]tar -xvfz apr-1.2.7.tar.gz
[root@mysql51 down]cd apr-1.2.7
[root@mysql51 apr-1.2.7]# ./configure --prefix=/usr/local/apr-apache
[root@mysql51 apr-1.2.7]# make
[root@mysql51 apr-1.2.7]# make install

[root@mysql51 down]# tar -zxvf apr-util-1.2.7.tar.gz
[root@mysql51 down]# cd apr-util-1.2.7
[root@mysql51 apr-util-1.2.7]# ./configure --prefix=/usr/local/apr-util-apache --with-apr=/usr/local/apr-apache/
[root@mysql51 apr-util-1.2.7]# make
[root@mysql51 apr-util-1.2.7]# make install

三、安装APACHE

[root@dns redhat]#chmod  777  httpd-2.2.15.tar.gz
[root@dns redhat]# cd httpd-2.2.15
[root@mysql51 httpd-2.2.15]# ./configure --prefix=/usr/local/apache2 --with-mpm=worker --enable-so --enable-mods-shared=all --enable-moduls=most --enable-rewrite --enable-heades --disable-status --enable-dav --enable-dav-fs --enable-dav-lock --with-apr=/usr/local/apr-apache/ --with-apr-util=/usr/local/apr-util-apache/

*********************************************
--prefix=/usr/local/apache2   #指定安装目录
--with-mpm=worker                  #使用worker 多处理器模块加入核心
--enable-so                                 #动态加载模块(DSO)支持到httpd二进制文件,有了DSO支持,升级和增加模块时只需编译相关模块即可,不必重新编译整个系统。
--enable-mods-shared=all       #以DSO方式编译全部的模块
--enable-module=most   
--enable-rewrite                       #一个基于一定规则的实时重写URL 请求的引擎
--enable-headers         #允许通过配置文件控制任意的HTTP 请求和应答头信息
--disable-status                            #禁用服务器状态
--enable-dav --enable-dav-fs --enable-dav-lock  #加载webdav模块
--with-apr=/usr/local/apr-apache/ --with-apr-util=/usr/local/apr-util-apache/                                                #指定apr路径

***********************************************

[root@dns httpd-2.2.15]#make
[root@dns httpd-2.2.15]#make install

开机自启动
[root@dns rc.d]# echo "/usr/local/apache2/bin/apachectl start" >> rc.local


四、安装PHP
1、安装Php
[root@mysql51 down]# tar -xvzf php-5.2.13.tar.gz
[root@mysql51 down]# cd php-5.2.13
[root@mysql51 php-5.2.13]# ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql/ --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql/ --enable-soap --with-gd --enable-sockets --enable-mbstring --disable-ipv6 --enable-exif --with-zlib --with-curl -with-curlwrappers --enable-calendar --with-gettext --enable-gd-native-ttf --enable-zend-multibyte --with-bz2  --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-libxml-dir
****************************************************
--prefix=/usr/local/php5                     \\指定 php 安装目录
--with-apxs2=/usr/local/apache2/bin/apxs    \\整合 apache,apxs功能是使用mod_so中的 LoadModule指令,加载指定模块到pache,要求 apache 要打开SO模块
--with-MySQL=/usr/local/mysql            \\mysql安装目录,对mysql的支持
--with-mysqli=/usr/local/mysql/bin/mysql_config   \\mysqli扩展技术不仅可以调用MySQL的存储过程、处理MySQL事务,而且还可以使访问数据库工作变得更加稳定。
--with-pdo-mysql=/usr/local/mysql  #同样MSYQL支持
--enable-soap                   \\启用SOAP支持
--with-gd                           \\打开gd库的支持
--enable-sockets              \\打开 sockets 支持
--enable-mbstring             \\多字节,字符串的支持
--disable-ipv6                    \\关闭IPV6支持
--with-zlib                           \\打开zlib库的支持
--enable-exif                      \\图片的元数据支持
--with-curl                           \\打开curl浏览工具的支持
--with-curlwrappers            \\运用curl工具打开url流
--enable-calendar               \\打开日历扩展功能
--with-gettext                      \\打开gnu 的gettext 支持,编码库用到
--enable-gd-native-ttf         \\支持TrueType字符串函数库
--enable-zend-multibyte      \\  支持zend的多字节
--with-bz2                             \\打开对bz2文件的支持
--with-jpeg-dir                      \\打开对jpeg图片的支持
--with-png-dir                       \\打开对png图片的支持
--with-freetype-dir               \\打开对freetype字体库的支持
--with-iconv-dir
--with-libxml-dir                     \\打开libxml2库的支持

**********************************************************

[root@mysql51 php-5.2.13]#make
[root@mysql51 php-5.2.13]]#make test
[root@mysql51 php-5.2.13]#make install
[root@mysql51 php-5.2.13]#cp php.ini-dist /usr/local/php5/lib/php.ini
[root@mysql51 php-5.2.13]#vi /usr/local/apache2/conf/httpd.conf
注意一下 105 行
LoadModule php5_module        modules/libphp5.so
在360行     AddType application/x-gzip .gz .tgz后添加   

   AddType application/x-httpd-php .php .phtml
    AddType application/x-httpd-php-source .phps

找到Directory index 后面添加 index.php

2、重启apache
[root@ olym php-5.2.3]cd /usr/local/apache2/htdocs/
[root@dns htdocs]#
touch index.php


终于安装完毕,总的来说,是安装APACHE+MYSQL+PHP最完整的一次了,哪里不足之处请多多指教。LAMP常用的一些参数
apache:
--enable-headers --enable-deflate:使用apache的压缩模块mod_deflate.so
提高网站的访问速度





运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-640015-1-1.html 上篇帖子: svn,apache,trac整合 下篇帖子: Apache之RPM包安装与源码安装区别
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表