Ubuntu LAMP环境PHP5.6

1.安装Apache

sudo apt-get update
sudo apt-get install apache2

 2.启动Apache

service apache2 restart

启动的时候可能会出现如下警告:

apache2: Could not determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName 
说明你没有指定ServerName。如果想去掉这个错误,可以修改/etc/apache2/apache2.conf文件:

sudo vi /etc/apache2/apache2.conf 
添加如下行:

ServerName localhost

3.开启伪静态

vim /etc/apache2/apache2.conf

#添加如下代码
<IfModule mod_rewrite.c>
  Options +FollowSymlinks -Multiviews
  RewriteEngine On

  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^(.*)$ index.php?/$1 [QSA,PT,L]
</IfModule>
#重启Apache
service apache2 restart

4.安装PHP5.6

sudo add-apt-repository ppa:ondrej/php 
sudo apt-get update 
sudo apt-get -y install php5.6 php5.6-mcrypt php5.6-mbstring php5.6-curl php5.6-cli php5.6-mysql php5.6-gd php5.6-intl php5.6-xsl php5.6-zip php5.6-cgi libapache2-mod-php5.6

5.安装mysql

sudo apt-get install mysql-server

 

posted @ 2018-06-07 11:09  暮雨浅忆  阅读(182)  评论(0编辑  收藏  举报