This article mainly share with you about Ubuntu build PHP Development Environment Example Tutorial, followed this article to learn to help you complete the Ubuntu build PHP development environment.
Apache Installation
Install Apache server first, use Apt-get to download and install software under Ubuntu.
After you enter your password, you are ready to download the installation, open the browser after installation, enter localhost to see if the installation was successful.
If shown above, the installation was successful.
PHP Installation
Here I am going to install the PHP7.0 version, at the command line input: sudo apt-get install php7.0
After the installation is complete, enter: php-v to see if PHP is installed successfully
PHP and Apache are installed after the need to enable Apache to identify the parsing PHP files, we first search for a suitable PHP7 plug-in, input command: Apt-cache search libapache2-mod-php
You can see that there is a PHP7.0 version of the results, we will install this: sudo apt-get install libapache2-mod-php7.0
Below we can write a PHP file to see if you can parse the access. Input command: cd/var/www/html switch to Apache project directory, new file: sudo vim test.php
Save after browser access: localhost/test.php
If everything works, you'll see some information about PHP.
MySQL Installation
The next step is to install the database MySQL, the database needs to install server and client two, input command: sudo apt-get install mysql-server mysql-client
During installation, you will be prompted to set the login password for the root account, then select OK to continue the installation
After the installation is complete, enter MYSQL-V to view the installed version information
Again, we need MySQL to be able to interact with PHP and install PHP's MySQL plugin: sudo apt-get install Php7.0-mysql
Finally, we can also install some common PHP extensions
The software on the lamp is installed, and the Composer:sudo apt-get install composer can be installed at the end.
After installation, enter the command: composer to see if it is successful.
Display, the installation process is complete.