Apache server + php + mysql

Apache httpd 

mutian@mutian:~/soft$ tar -zxvf httpd-2.2.31.tar.gz
mutian@mutian:~/soft/httpd-2.2.31$ ./configure --prefix=/home/mutian/soft/apache2  //指定安装目录为/home/mutian/soft/apache2
mutian@mutian:~/soft/httpd-2.2.31$ make
mutian@mutian:~/soft/httpd-2.2.31$ make install
mutian@mutian:~/soft/apache2$ sudo ./apachectl start //必须用sudo,否则权限可能不够
mutian@mutian:~/soft/apache2$ sudo ./apachectl stop
// http://127.0.0.1:80   //default port:80

 不指定安装目录时,其安装目录为:/etc/php5/apach2

PHP 配置

mutian@mutian:~/soft/php-5.5.32$ ./configure --prefix=/home/mutian/soft/php --with-apxs2=/home/mutian/soft/apache2/bin/apxs --with-config-file-path=/usr/local/lib --enable-track-vars --with-xml --with-mysql  --with-zlib-dir=/usr/lib
mutian@mutian:~/soft/php-5.5.32$ make -j4
mutian@mutian:~/soft/php-5.5.32$ make install
mutian@mutian:~/soft/php-5.5.32$ cp php.ini-production /home/mutian/soft/php/etc/php.ini

配置Apache中的PHP环境
需要修改Apache的配置文件httpd.conf以得到PHP的解析:  
1、在LoadModule中添加
LoadModule php5_module   modules/libphp5.so
2、在AddType application/x-gzip .gz .tgz下面添加
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
3、在DirectoryIndex增加 index.php,以便Apache识别PHP格式的
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

添加新文件index.php
mutian@mutian:~/soft/apache2/htdocs$ cat index.php
<?php   phpinfo();  ?>

配置好后
mutian@mutian:~/soft/apache2/bin$ sudo ./apachectl stop
mutian@mutian:~/soft/apache2/bin$ sudo ./apachectl start

打开http://127.0.0.1:80

 

mysql install:

mutian@mutian:~$ sudo apt-get install mysql-server
mutian@mutian:~$ sudo apt-get install mysql-client
mutian@mutian:~$ sudo apt-get install libmysqlclient-dev

 

安装论坛discuz

解压文件至 ~/soft/apache2/htdocs
ubuntu乱码问题 需要下载utf8格式源码

  

 apache无法启动 80端口被占用

mutian@mutian:~/soft/apache2/bin$ sudo ./apachectl start
[sudo] password for mutian:
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
mutian@mutian:~/soft/apache2$ netstat -npl |grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN off (0.00/0/0)
tcp 1 0 10.46.36.218:41893 91.189.89.144:80 CLOSE_WAIT off (0.00/0/0)
mutian@mutian:~/soft/apache2/bin$ ps aux
www-data 3276 0.0 0.1 105756 4776 ? S 12:38 0:00 /usr/sbin/apache2 -k start
www-data 3278 0.0 0.1 105756 4776 ? S 12:38 0:00 /usr/sbin/apache2 -k start
mutian@mutian:~/soft/apache2$ sudo /etc/init.d/apache2 stop     // 系统可能自带的apache占用了80端口
mutian@mutian:~/soft/apache2/bin$ sudo ./apachectl start

 

Discuz论坛管理
添加模块
登录管理员帐号
“管理中心” => "论坛"

论坛模型为
分区1
  板块1
  板块2
分区2
  板块1
  板块2

 

posted @ 2016-02-05 16:34  牧 天  阅读(165)  评论(0)    收藏  举报