Apache+PHP+MySQL安装相关

A. Install MySQL on Linux (From MySQL official site -- www.mysql.com)
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> gunzip  cd mysql-VERSION
shell> CFLAGS="-O3" CXX=gcc CXXFLAGS="-O3 -felide-constructors \
       -fno-exceptions -fno-rtti" ./configure \
       --prefix=/usr/local/mysql --enable-assembler \
       --with-mysqld-ldflags=-all-static
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> bin/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql var
shell> bin/mysqld_safe --user=mysql &
 
B. Install apache
 
shell> tar xjvf httpd-VERSION.tar.bz2
shell> cd httpd-VERSION
shell> ./configure --prefix=/usr/local/apache --enable-so
      PS: If you want to enable the most modules of apache,you can use "--enable-module=most". "--enable-modules=all" will enable all the modules of apache.
shell> make
shell> make install
 
C. Install php
 
shell> tar xzvf php-VERSION.tar.gz
shell> cd php-VERSION
shell> ./configure --prefix=/usr/local/php\
       --with-apxs2=/usr/local/apache/bin/apxs --with-mysql=/usr/local/mysql
shell> make
shell> make install
shell> cp php.ini-dist /usr/local/php/lib/php.ini
 
D. Post configuration
 
  Make sure the libphp5.so in /usr/local/apache/modules/ directory.then edit the httpd.conf in /usr/local/apache/conf/ directory with you fimilar text edit tools,such as vi. check if there is a line like this:
 
   LoadModule php5_module        modules/libphp5.so
 
then,add the following lines to httpd.conf:
 
   AddType application/x-httpd-php .php .php3 .php4 .phtml
   AddType application/x-httpd-php-source .phps
 
E. Start service and check if it works properly
 
  Put a file named test.php into apache's document-root. add the following lines to test.php:
 
     phpinfo();
  ?>
 
  starting the web service via "/usr/local/apache/bin/apachectl start",and browsing it with your web client.(i.e Firefox):
  http://127.0.0.1/test.php
 
this should works, but you still have a lot of works to do to make web server safer.

相关推荐