lmgsanm

每天学习一点,每天进步一点点…… Tomorrow is another beatifull day

导航

Linux+mysql+apache+php

1.1.1               所需软件

  • cmake
  • ncourse
  • mysql
  • apr
  • apr-util
  • pcre
  • apache
  • php

1.1.2               解压缩软件

进入/usr/src/soft目录

tar xzf /usr/src/tar/httpd-2.4.10.tar.gz -C /usr/src/soft/

tar xzf /usr/src/tar/ apr-util-1.5.4.tar.gz -C /usr/src/soft/

tar xzf /usr/src/tar/ apr-1.5.2.tar.gz -C /usr/src/soft/

tar xzf /usr/src/tar/mysql-5.6.22.tar.gz -C /usr/src/soft/

tar xzf /usr/src/tar/pcre-8.35.tar.gz -C /usr/src/soft/

tar xzf /usr/src/tar/cmake-3.0.0.tar.gz -C /usr/src/soft/

tar xzf /usr/src/tar/ncurses.tar.gz -C /usr/src/soft/

tar xzf /usr/src/tar/php-5.6.0.tar.gz -C /usr/src/soft/

1.1.3               软件安装

1.1.3.1          安装cmake

cd /usr/src/soft/cmake-3.0.0/

./configure

make && make install

1.1.3.2          安装ncourse

cd /usr/src/soft/ncurses-5.9/

./configure

make && make install

1.1.3.3          安装mysql

groupadd mysql

useradd -r -g mysql mysql

cmake .

  make

  make install

           cd /usr/local/mysql/

chown -R mysql .

chgrp -R mysql .

scripts/mysql_install_db --user=mysql

chown -R root .

chown -R mysql data

bin/mysqld_safe --user=mysql &

cp support-files/mysql.server /etc/init.d/mysqld

1.1.3.4          安装apr

cd srclib/apr

./configure --prefix=/usr/local/apr

make && make install

1.1.3.5          安装apr-util

cd ../apr-util/

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/

make && make install

1.1.3.6          安装pcre

cd /usr/src/soft/pcre-8.35/

./configure --prefix=/usr/local/pcre

make && make install

PATH=$PATH:/usr/local/pcretbin/

1.1.3.7          安装httpd

cd /usr/src/soft/httpd-2.4.10

./configure --prefix=/usr/local/apache \

--enable-so \

--with-apr=/usr/local/apr \

--with-apr-util=/usr/local/apr-util/bin \

--enable-mods-shared=all \

--with-mpm=worker \

--enable-cache \

--enable-disk-cache \

--enable-mem-cache \

--enable-file-cache\

--with-pcr=/usr/local/pcre/

make

make install

         更改httpd.conf中的ServerName

1.1.3.8          安装PHP

cd /usr/src/soft/php-5.6.0/

./configure --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql/

make && make install

cp php.ini-development /usr/local/lib/php.ini

vi /usr/local/apache/conf/httpd.conf

<IfModule mime_module>

SetHandler application/x-httpd-php

</IfModule>

1.1.4               软件配置

1.1.4.1          httpd.conf配置

vi /usr/local/apache/conf/httpd.conf

         ServerName 127.0.0.1:80

         <IfModule mime_module>

SetHandler application/x-httpd-php

</IfModule>

 

对个版本来说,添加如下语句以支持PHP

        AddType application/x-httpd-php .php

 

AddHandler php-script .php
AddType text/html .php
 

1.1.5               软件测试

1.1.5.1          Apache测试

在浏览器中输入:http://172.16.2.82

如显示:“It Works”则证明该软件正常运行

1.1.5.2          php测试

写一个简单的phpinfo脚本,如下

vi /usr/local/apache/htdocs/phpinfo.php

         <?php

        phpinfo();

?>

         在浏览器中输入:http://172.16.2.82/phpinfo.php

         测试该脚本是否能够正常显示PHP的相关信息

posted on 2015-07-26 02:01  lmgsanm  阅读(195)  评论(0编辑  收藏  举报