Ubuntu12.04 build a php development environment

Source: Internet
Author: User
Ubuntu12.04 build php development environment install MySQLsudoapt-getinstallmysql-server install Apachesudoapt-getinstallapache2 install PHP5sudoapt-getinstallphp5 other modules configure APACHE + PHPsudoapt-getinstalll Ubuntu 12.04 build php development environment

Install MySQL
Sudo apt-get install mysql-server

Install Apache
Sudo apt-get install apache2

Install PHP5
Sudo apt-get install php5

Other modules
// Configure APACHE + PHP
Sudo apt-get install libapache2-mod-php5

// Enable apache to support mysql
Sudo apt-get install libapache2-mod-auth-mysql

// Mysql connection
Sudo apt-get install php5-mysql

// GD Library
Sudo apt-get install php5-gd

?

PhpMyAdmin
Sudo apt-get install phpMyAdmin

Some configurations, such as passwords, are prompted during installation.

After the installation, the default root directory of the php network service is/var/www. if you want to perform read/write operations on it:
Sudo chmod 777/var/www

Test configuration complete: open? Http: // 127.0.0.1? Or http: // localhost

Phpmyadmin settings:
During the installation process, you must select Web server: apache2 or lighttpd, select apache2, press the tab key, and click OK. Then, you are required to enter the Mysql database Password of the database's administrative user.
Then, establish a connection between phpmyadmin and apache2. take my example: the www directory is in the/var/www directory, and The phpmyadmin directory is in the/usr/share/phpmyadmin Directory. Therefore, run the following command:
Sudo ln-s/usr/share/phpmyadmin/var/www
Establish a connection.

Phpmyadmin test: open http: // localhost/phpmyadmin in the address bar of the browser

Configure Apache

1. enable mod_rewrite module

Terminal Command: sudo a2enmod rewrite
Restart Apache Server: sudo/etc/init. d/apache2 restart

After Apache is restarted, we can test whether to create a file test. php under the/var/www directory and write the code: <? Php phpinfo ();?> Save, enter http: // 127.0.0.1/test. php in the address bar? Or http: // localhost/test. php. if the correct php configuration information appears, it indicates that LAMP Apache is working properly (remember to restart the Apache server before testing ).

2.set apacheto support .htm. html. php

Sudo gedit/etc/apache2/apache2.conf
Or sudo gedit/etc/apache2/mod-enabled/php5.conf
Add
AddType application/x-httpd-php. php. htm. html
You can.

Several terminal commands frequently used by LAMP components

Restart apache: sudo/etc/init. d/apache2 restart

Restart mysql: sudo/etc/init. d/mysql restart

Configure php. ini: sudo gedit/etc/php5/apache2/php. ini

Configure apache2.conf: sudo gedit/etc/apache2/apache2.conf

Configure my. cnf: sudo gedit/etc/mysql/my. cnf

Php cgi: sudo/var/www/cgi-bin/

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.