1、安装Apachephp
一、配置html
/configure --prefix=/usr/local/apache2 --with-included-apr --enable-so --enable-deflate=shared --enable-expires=shared --enable-rewrite=shared --enable-static-support --disable-userdir
二、编译mysql
make
三、安装c++
make install
四、启动与关闭web
/usr/local/apache2/bin/apachectl start #启动 netstat -tnl #查看端口是否开启 /usr/local/apache2/bin/apachectl stop #中止
Apache安装成功后,网站的目录在Apache安装目录下的htdocs目录下。绝对路径为:/usr/local/apache2/htdocssql
2、源码安装phpshell
一、配置apache
/configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php/etc --with-jpeg-dir --with-png-dir --with-bz2 --with-freetype-dir --with-iconv-dir --with-zlib-dir --enable-soap --enable-gd-native-ttf --enable-ftp --enable-sockets --enable-mbstring --enable-exif --enable-memcache --enable-vld
其中--with-apxs2=/usr/local/apache2/bin/apxs是进行apache关联,为上面安装Apache的具体路径vim
二、编译app
make
编译后可能会报错,根据报错。通常都是libxml二、bzip2什么的没有安装。那咱们用yum命令安装就行.缺什么安装什么
yum install bzip2 yum install bzip2-devel yum install libxml2 yum install libxml-devel
三、安装
make install
四、将安装包中的php.ini-dist文件复制并重命名到以下目录
cp /usr/src/php-5.2.6/php.ini-dist /usr/local/php/etc/php.ini
3、Apache与PHP结合
其实在/usr/local/apache2/conf/httpd.conf文件中添加以下东西便可让Apache解析PHP。都不用最下面一长串了。
Listen 80
NameVirtualHost *:80
<VirtualHost *:80 >
ServerAdmin example@company.com
DocumentRoot /usr/local/apache2/htdocs
<Directory "/usr/local/apache2/htdocs">
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
一、 Apache主配置文件为:/usr/local/apache2/conf/httpd.conf
# vim /usr/local/apache2/conf/httpd.conf
找到:
AddType application/x-gzip .gz .tgz
在该行下面添加
AddType application/x-httpd-php .php
二、修改默认读取文件
找到:
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
将该行改成
<IfModule dir_module>
DirectoryIndex index.html index.htm index.php
</IfModule>
三、找到:
#Include conf/extra/httpd-mpm.conf
#Include conf/extra/httpd-info.conf
#Include conf/extra/httpd-vhosts.conf
#Include conf/extra/httpd-default.conf
去掉前面的“#”号,取消注释。
4、配置Apache虚拟主机
一、配置文件为:/usr/local/apache2/conf/extra/httpd-vhosts.conf
将配置文件中下面一段修改成以下:
<VirtualHost *:80> # ServerAdmin webmaster@dummy-host.example.com DocumentRoot "/data/www" ServerName www.example.com.cn ErrorLog "|/usr/local/apache2/bin/rotatelogs -l /www/logs/error.log-%Y%m%d 86400" CustomLog "|/usr/local/apache2/bin/rotatelogs -l /www/logs/access.log-%Y%m%d 86400" combined </VirtualHost>
说明:
ServerAdmin 参数后为管理员email
DocumentRoot 指的是论坛文件存放的目录
ServerName 是论坛的域名
ErrorLog 是论坛错误日志 经过管道使用apache自带的rotatelogs工具将日志切割为天天一个文件
CustomLog 是论坛访问日志,一样切割为天天一个文件
二、配置Apache缺省httpd设置
配置文件为:/usr/local/apache2/conf/extra/httpd-default.conf
将配置文件中下面一段:
将KeepAlive On 改成KeepAlive Off
三、配置Apache的访问权限
vim /usr/local/apache2/conf/httpd.conf
找到
<Directory />
Options FollowSymlinks
AllowOverride None
Order deny,allow
Deny form all
</Directory>
改为:
<Directory />
Options FollowSymlinks
AllowOverride None
Order deny,allow
Allow form all
</Directory>
四、配置Apache的运行帐户
vim /usr/local/apache2/conf/httpd.conf
找到
User daemon
Group daemon
改为
User www
Group www
通过上面一系列:Apache终于能够解析PHP文件了
5、Mysql安装
一、配置
./configure --prefix=/usr/local/mysql --without-debug --enable-thread-safe-client --with-pthread --enable-assembler --enable-profiling --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-extra-charsets=all --with-plugins=all --with-mysqld-user=mysql --without-embedded-server --with-server-suffix=-community --with-unix-socket-path=/tmp/mysql.sock
安装mysql的时候出现了No curses
解决方式(CentOS)
yum list|grep ncurses
yum -y install ncurses-devel
二、编译
make
make时出错
../depcomp: line 571: exec: g++: not found
make[1]: *** [my_new.o] 错误 127
make[1]: Leaving directory `/usr/local/src/mysql/mysql-5.1.32/mysys`
make: *** [all-recursive] 错误 1
解决:
#yum install gcc-c++ 可解决问题。
从新指定安装路径:
#./configure --prefix=/usr/local/mysql-5.0.90
make
三、安装
make install