ubuntu18 安裝apache2.4 php5.6 mysql5.6
安裝包下載:
連結:https://pan.baidu.com/s/1uoVMy_QNyR_zqVi06QPqKg
提取碼:ll7s
注意:
ubuntu安裝:sudo apt-get install gcc build-essential(這個是c++編譯環境)
當apr_xml.c報錯嘗試 sudo apt-get install libexpat1-dev
1、安裝編譯環境
sudo apt-get install gcc build-essential libexpat1-dev -y
2、安裝pcre
./configure --prefix=/usr/local/pcre
3、安裝apr apr-util
./configure --prefix=/usr/local/apr
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
4、安裝apache
./configure --prefix=/usr/local/apache2 --enable-so --disable-env --enable-rewrite --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
5、安裝linxml2
sudo apt-get install libxml2* -y
6、安裝php
./configure --prefix=/usr/local/php5.6 --bindir=/usr/local/bin --sbindir=/usr/local/sbin --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/php5.6/etc --with-mysql --with-pdo-mysql
php需要配置apxs 來支援apache(httpd-devel),apache1.x 使用--with-apxs,2.x使用--with-apxs2
7、配置php
sudo cp php.ini-development /usr/local/php5.6/etc/php.ini
8、配置apache
sudo vim /usr/local/apache2/conf/httpd.conf
LoadModule php5_module modules/libphp5.so
配置完apxs預設已經掛在了libphp5.so ,只需要讓他解析就ok
DocumentRoot "/var/www/html"
<Directory "/var/www/html">
預設網站根在apache目錄下htdocs目錄中。這裡我改成了/var/www/html
<IfModule dir_module>
DirectoryIndex index.html index.php home.php default.php
</IfModule>
預設載入的網站檔案
然後在<IfModule mime_module>裡面新增解析php檔案
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php .phtml
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
支援虛擬主機功能。然後需要先去conf/extra/httpd-vhosts.conf原有的條目遮蔽掉,改成自己的。
9、安裝mysql
tar -xf xxx.tar
sudo dpkg -i mysql*
sudo apt-get install -f
輸入mysql密碼
配置檔案:/etc/myslq/my.cnf