首页 > 代码库 > apache-mysql-php安装与配置

apache-mysql-php安装与配置

################## APACHE ###############
#./configure --prefix=/usr/local/apache --with-apr=/usr/local/apr-1.5/bin/apr-1-config --with-apr-util=/usr/local/apr-util-1.5/bin/apu-1-config -enable-so --enable-dav --enable-maintainer-mode --enable-rewrite --with-pcre=/usr/local/pcre-8.35/bin/pcre-config
#make;make install

apache 作为linux启动就运行服务程序
cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd
但是在执行:
chkconfig --add httpd
chkconfig httpd on
的时候出现错误:service httpd does not support chkconfig
解决办法:
打开 vi /etc/rc.d/init.d/httpd 添加(#!/bin/sh下面)
#chkconfig: 2345 10 90
#description: Activates/Deactivates Apache Web Server
加上上面这两行就可以,#必须有


################## MySQL ###############
#groupadd mysql
#useradd -r -g mysql mysql
# Beginning of source-build specific instructions
#tar zxvf mysql-VERSION.tar.gz
#cd mysql-VERSION
#cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DMYSQL_DATADIR=/usr/local/mysql/data -DSYSCONFDIR=/etc -DWITH_MYISAM_STORAGE_ENGINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_MEMORY_STORAGE_ENGINE=1 -DWITH
_READLINE=1 -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock -DMYSQL_TCP_PORT=3306 -DENABLED_LOCAL_INFILE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DEXTRA_CHARSETS=all -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_gene
ral_ci
#make
#make install
# End of source-build specific instructions
# Postinstallation setup
#cd /usr/local/mysql
#chown -R mysql .
#chgrp -R mysql .
#scripts/mysql_install_db --user=mysql
#chown -R root .
#chown -R mysql data

手动启动MySQL。
#cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
#/etc/init.d/mysqld start
##或者
#service mysqld start

在上面的步骤后,开机自动启动设置
#chkconfig --add mysqld
##有的系统需要下面的
#chkconfig --level 345 mysqld on

 

################## PHP ###############
php-5.6.2/ext/mysqli
#./configure --with-php-config=/usr/local/php/bin/php-config --with-mysqli=/usr/local/mysql/bin/mysql_config
#make;make install

php-5.6.2/ext/pdo-mysql
#./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql/
#make;make install

#wget http://xmlsoft.org/sources/libxslt-1.1.28.tar.gz
#./configure --prefix=/usr/local/libxslt --with-libxml-prefix=/usr/local/libxml2/
#make;make install
php-5.6.2/ext/xsl
#./configure --with-php-config=/usr/local/php/bin/php-config --with-xsl=/usr/local/libxslt/
#make;make install

#wget http://pecl.php.net/get/apcu-4.0.6.tgz
#./configure --with-php-config=/usr/local/php/bin/php-config --enable-apcu --enable-apc-bc
#make;make install

最后
#vi /usr/local/apache/conf/httpd.conf 用于解释PHP文件
#php parse supported
<FilesMatch "\.ph(p[2-6]?|tml)$">
SetHandler application/x-httpd-php
</FilesMatch>

# .phps with PHP source filter parse
#<FilesMatch "\.phps$">
# SetHandler application/x-httpd-php-source
#</FilesMatch>

简单测试
#touch phpinfo.php
#vi phpinfo.php
<?php
phpinfo();
?>
#输入:http://localhost/phpinfo.php

 

apache-mysql-php安装与配置