Build a PHP development environment
install apache2
- $ apt-get install apache2
Open http://localhost , if you can see the welcome page (as shown in the figure below), the installation of apache2 is successful.
Install mysql5.6
$ apt-get install mysql-server mysql-client
apt-get install php7.0-mysql
sudo start mysql #Start like this manually
sudo stop mysql #Manual stop
Install php7.0
(1) Add PHP7 PPA
- Install the add-apt-repository package: apt-get install python-software-properties software-properties-common
Use the add-apt-repository command to add PPA: add-apt-repository ppa:ondrej/php #The latter php is lowercase! The pit father's CSDN automatically converts it to uppercase
- Update apt configuration: apt-get update
(2) Install PHP7
- sudo apt-get install php7.0 libapache2-mod-php7.0
install php module
First search what modules are there
- $ apt-cache search php7.0-
Install the packages you think you need to install
- $ apt-get install php7.0-cli php7.0-common php7.0-curl php7.0-gd php7.0-json php7.0-mysql php7.0-imap php7.0-intl php7.0-xdebug
After installation, you need to test php
- $ vim /var/www/html/info.php
Enter a line:, save
Open the browser http://localhost/info.php , when the picture below appears, it means that php is already running.
install phpmyadmin
- $ apt-get install phpmyadmin 安装phpmyadmin
During the installation process, the option settings will pop up, select apache2, then yes, and then enter the database root password root.
Then you need to configure phpmyadmin
- $ vim /etc/apache2/apache2.conf Open the apache2 configuration file and add a line
Include /etc/phpmyadmin/apache.conf
- $ service apache2 restart restart apache server
Then open the browser http://localhost/phpmyadmin and see the phpmyadmin login interface (below), indicating that the installation is successful.