ubuntu16.04 Configuration apache2 and PHP

Source: Internet
Author: User
Tags install php

System version: ubuntu16.04

Commands are entered in the terminal, tested with the browser

Install the APACHE2 command

sudo apt install apache2

Test whether the installation was successful

Enter "localhost" in the browser address bar

Install the latest version of PHP command

sudo apt install php

Configuring Apache2 and PHP commands

sudo apt-get install libapache2-mod-php

Restart Apache2 command

Sudo/etc/init.d/apache2 restart


Test PHP, borrow the first program on W3school

1 <! DOCTYPE html> 2  3 <body> 4  5 <? PHP 6 Echo "My first piece of PHP script! "; 7 ?> 8  9 </body> 

Save as test.php, copy into/var/www/html directory

Browser address bar Input localhost/test.php

Complete

ubuntu16.04 configuration apache2 and PHP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.