Ubuntu16.04搭建LAMP环境
准备工作
sudo apt-get update sudo apt-get install -y language-pack-en-base locale-gen en_US.UTF-8 sudo apt-get install software-properties-common sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php sudo apt-get update
安装Apache
sudo apt-get install -y apache2
安装MySQL
sudo apt-get -y install mysql-server
sudo apt-get -y install mysql-client
安装PHP及模块
sudo apt install -y php7.0 php7.0-mysql php7.0-fpm php7.0-curl php7.0-xml php7.0-mcrypt php7.0-json php7.0-gd php7.0-mbstring php7.0-zip php-mongodb memcached php-memcached php-redis libapache2-mod-php7.0 libaprutil1-dbd-mysql
修改php配置
sudo vim /etc/php/7.0/fpm/php.ini // 将cgi.fix_pathinfo=1这一行去掉注释,将1改为0 sudo vim /etc/php/7.0/fpm/pool.d/www.conf listen = /var/run/php/php7.0-fpm.sock // 更改 sudo service php7.0-fpm restart