Ubuntu Installation Php+mysql+apche

Source: Internet
Author: User

Step One, install Apache2?1sudo apt-Getinstallation of Install apache2 is complete. Run the following command to restart:?1sudo/etc/init.d/apache2 Restart enter HTTP in the browser://localhost or http://127.0.0.1, if you see the IT works!, it means that Apache installed successfully, Apache default installation, will be in/var under a directory called WWW, this is the Web directory, All Web files that can be accessed by the browser are placed in this directory. Step Two, install PHP:?1sudo apt-GetInstall libapache2-mod-php5 PHP5 Also, it is recommended to install the extension php5-GD php5-MySQL, install the same way. After installation, we will restart Apache and let it load the PHP module:?1sudo/etc/init.d/apache2 Restart Next, we'll create a new test.php file under the Web directory to test if PHP works properly, command:?1sudo gedit/var/www/test.php then enter:?12<?php Echo &quot;hello,world!! &quot;? >then save the file and enter HTTP in the browser://127.0.0.1/test.php, if the hello,world!! is displayed in the Web page, it means that PHP is working properly. step three, install the MySQL database:?1sudo apt-GetInstall Mysql-server mysql-clientapt-The Get program will automatically download and install the latest MySQL version. At the end of the installation, it will require the root password to be entered, note that the root password here is not the root password of Ubuntu, it is the root password you want to set for MySQL. Step four, install phpMyAdmin-MySQL database management?1sudo apt-GetInstall phpmyadminphpmyadmin settings: During installation you will be asked to select the Web server:apache2 or LIGHTTPD, use the SPACEBAR to choose Apache2, press the TAB key and then OK. You will then be asked to enter the MySQL database password for the setup password password of the database ' s administrative user. Then connect the phpMyAdmin with the apache2, take my example: www directory in/var/www,phpmyadmin in/usr/share/phpMyAdmin directory, so just use the command:?1Sudo ln-s/usr/share/phpmyadmin/var/www to establish a link. phpMyAdmin Test: Open http in the browser address bar://Localhost/phpmyadmin. the basic components of the above ALMP have been installed, let us look at some other settings: Step five, set the Ubuntu file to read and write permissions after the installation of lamp, the default settings for the PHP Web server root directory are:/var/www. Because of the security principle of Linux system, the file read and write permission in the directory is only allowed by root user, so we can't create a new php file in www folder, can not modify and delete it, we must first modify/var/Read and Write permissions for the WWW directory. In the interface manager through the right-click property cannot modify the file permissions, you have to execute the root terminal command:?1sudo chmod777/var/www. You can then write to the HTML or PHP file. 777 is the highest privilege in Linux, which means readable, writable, and executable. 

Ubuntu Installation Php+mysql+apche

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.