linux 下php环境的安装及Discuz论坛安装

冷暖自知 提交于 2020-03-02 16:42:48

1.安装apache
wget http://apache.mirror.phpchina.com/httpd/httpd-2.2.9.tar.gz
tar zxvf httpd-2.2.17.tar.gz
cd httpd-2.2.17
./configure --prefix=/usr/local/apache --enable-track-vars --enable-cgi --with-config-file-path=/usr/local/apache/conf
make
sudo make install

2 安装libpng
wget http://sourceforge.net/projects/libpng/files/libpng14/1.4.5/libpng-1.4.5.tar.gz/download
tar zxvf libpng-1.4.5.tar.gz
cd cd libpng-1.4.5
./configure
make
sudo make install

3.安装DG
wget http://www.libgd.org/releases/gd-2.0.35.tar.bz2
tar xvf gd-2.0.35.tar.bz2
cd gd-2.0.35
./configure --prefix=/usr/local/gd20/ --with-png=/usr/local/lib
make
sudo make install

4.安装mysql

wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.45.tar.gz/from/http://mysql.mirror.tw/

sudo groupadd mysql

sudo useradd -g mysql mysql

tar zxvf mysql-5.1.45.tar.gz

cd mysql-5.1.45

./configure --prefix=/usr/local/mysql --with-charset=utf8 --with-extra-charset=gbk,gb2312 --with-plugins=innobase  --with-unix-socket-path=/tmp/mysql.sock --with-mysqld-idflags=-all-static --enable-assembler

如出现:No curses/termcap library found
解决办法:sudo apt-get install libncurses5-dev

make

如出现:exec: g++: not found
解决办法L sudo apt-get install g++, 重新configure

sudo make install

cp support-files/my-medium.cnf /etc/my.cnf

cd /usr/local/mysql

sudo

sudo chown -R root  .

chown -R mysql var

sudo chgrp -R mysql .

启动mysql
bin/mysqld_safe --user=mysql &

5.安装php
wget http://cn.php.net/get/php-5.3.4.tar.bz2/from/this/mirror
tar xvf php-5.3.4.tar.bz2
cd php-5.3.4
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --enable-track-vars --enable-force-cgi-redirect --with-config-file-path=/usr/local/php/etc
--with-mysql=$MYSQL_DIR --with-gd=$GD_DIR --with-png-dir=/usr/local/lib
make
sudo make install
sudo cp php.ini-production /usr/local/php/php.ini
修改 /usr/local/php/php.ini
vi /usr/local/php/php.ini
找到short_open_tag = Off, 将Off改成On


6. 修改apache的配置
sudo vi /usr/local/apache/conf/httpd.conf
加上下面这段
<FilesMatch \.php$>
    SetHandler application/x-httpd-php
</FilesMatch>
注:在安装完php后,会自动加上LoadModule php5_module        modules/libphp5.so这句,如果没有加上的话,手动加上去

7.启动apache
/usr/local/apache/bin/apachectl start
停止命令为 /usr/local/apache/bin/apachectl stop

8.下载Ucenter, 安装discuz的话要先安装UCenter

wget http://download.comsenz.com/UCenter/1.5.2/UCenter_1.5.2_SC_UTF8.zip
unzip Center_1.5.2_SC_UTF8.zip
解压后会得到一个upload文件夹
mv upload /usr/local/apache/htdocs/ucenter
在浏览器中办理入 http://localhost/ucenter/install/index.php
然后按照说明一步一步安装

9.安装Discuz

wget http://download.comsenz.com/Discuz/7.2/Discuz_7.2_SC_UTF8.zip

unzip Discuz_7.2_SC_UTF8.zip
解压后会得到一个upload文件夹
mv upload /usr/local/apache/htdocs/ucenter
在浏览器中办理入 http://localhost/ucenter/install/index.php
然后按照说明一步一步安装


易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!