UBUNTU Lightweight One-click installation lamp and Configuration phpMyAdmin

Source: Internet
Author: User
Tags php editor php web server fully qualified domain name
UBUNTU Easy one-click installation lamp and Configuration phpMyAdmin
Wangking wrote

This article goes from Afar Blog: http://farlee.info/archives/linux-ubuntu-lamp-apache-mysql-php-phpmyadmin-install-configuration.html

?

PHP Development and server operating environment preferred LAMP combination, namely Linux+apache+mysql+php/perl/python, can optimize server performance. How do I install and configure the lamp environment in the local computer Ubuntu? Ubuntu9.10 itself is based on the Linux kernel, so Linux is ready. Using the Ubuntu LAMP Server package, you can easily implement the unified installation and configuration of Apache,mysql and PHP under Linux, and no longer need one to install the configuration.

How to install lamp components in Ubuntu environment?

using the Ubuntu Interface Manager :
System--Systems management----new software package Manager--edit--Use Task Token grouping package->lamp Server (tick), OK, return to the previous window click Apply (or System-> Administration->synaptic package Manager->edit->mark Packages by Task->lamp Server->ok). Then the system automatically downloads the installation lamp environment package and downloads it in a few minutes. You will be asked to set the password for the MySQL root account during installation, so remember. In addition, when the Ubuntu system is upgraded, the lamp environment component will also be updated to the latest version.

installation Complete Test : Open the Firefox browser in the address bar input 127.0.0.1, show it works! that the Apache server has started to work, lamp installation is done.



?

Linux Ubuntu LAMP Installation configuration Environment-it Works

Without using GNOME, it's easy to use terminal commands:
Direct one command : Apt-get install apache2 mysql-server mysql-client php5 php5-gd php5-mysql

Set Ubuntu file to execute read and write permissions

After the lamp is assembled and installed, 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 or modify or delete it, we must first modify the read and write permission of the/var/www directory. In the interface manager through the right-click property cannot modify the file permissions, you have to execute the root terminal command: sudo chmod 777 /var/www . You can then write to the HTML or PHP file.

How to install Phpmyadmin-mysql database management

using the interface Manager :
System--system management, new software package Manager, search phpmyadmin-> right-click Tag installation.
Or use a command directly: sudo apt-get install phpMyAdmin installation begins.

phpMyAdmin Settings :
During installation, you will be asked to select Web Server:apache2 or LIGHTTPD, select apache2, press TAB, 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: the WWW directory is in the/var/www,phpmyadmin directory in/usr/share/phpmyadmin, so just use the command: sudo ln-s/usr/share/ Phpmyadmin/var/www Establish a connection.

phpmyadmin Test : Open Http://localhost/phpmyadmin in the browser address bar.

Ubuntu LAMP How to configure Apache

1. Enable the Mod_rewrite module
Terminal command: sudo a2enmod rewrite
Restart Apache server: sudo/etc/init.d/apache2 restart

apache after reboot we can test, in the/var/www directory to create a new file test.php, write code:?? Save, enter http://127.0.0.1/test.php in the Address bar, or http://localhost/test.php, if the PHP configuration information appears correctly, then the lamp Apache is working properly ( Remember to restart the Apache server and test again).

2. Set Apache support. htm. html. php
sudo gedit/etc/apache2/apache2.conf
or sudo gedit/etc/apache2/mods-enabled/php5.conf
In the open file, add
AddType application/x-httpd-php. php. htm. html.

The MySQL test for lamp configuration

The above php,apache have been tested, let us test the MySQL database is correctly enabled.

Create a new mysql_test.php under the/var/www directory:

 
  

Save exit, enter http://127.0.0.1/mysql_test.php in the Address bar, show "MySQL is configured correctly" means OK, if not, restart the Apache server and try again.

Solve problems such as garbled characters in Firefox browser display

above in Firefox browser open mysql_test.php or phpMyAdmin when the test, if there is a Chinese garbled, it is the default language setting problem, the workaround is as follows:

Open Apache configuration file: Udo Gedit/etc/apache2/apache2.conf, at the end of the add: AddDefaultCharset UTF-8 , if still garbled, then UTF-8 instead of gb2312.
Restart Apache:sudo/etc/init.d/apache2 restart? Refresh mysql_test.php Chinese Characters no more.

If you want to manually start Mysql:mysql-u root-p, enter the password as prompted.
If you restart Apache, it appears:
* Restarting Web server apache2
Apache2:could not reliably determine the server ' s fully qualified domain name, using 127.0.1.1 for ServerName
Apache2:could not reliably determine the server ' s fully qualified domain name, using 127.0.1.1 for ServerName

or modify the Apache configuration file: sudo gedit/etc/apache2/apache2.conf, at the end of the file set: ServerName 127.0.0.1

Several terminal commands frequently used by lamp components

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

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

Configuring Php.ini:sudo Gedit/etc/php5/apache2/php.ini

Configuring Apache2.conf:sudo gedit/etc/apache2/apache2.conf

Configuring My.cnf:sudo GEDIT/ETC/MYSQL/MY.CNF

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

Ubuntu PHP Editor

finally Lamp Configuration just finished, in Ubuntu under the simple PHP code editing, with Gedit can be. Gedit supports code highlighting in nearly dozens of languages such as Html,php,javascsript. In the case of PHP project development, it is recommended to use the PHP IDE editor, such as Zend Studio, Eclipse. It is said that the text editor Vim is also very good.

PS: If you want to build a lamp environment under Windows XP, we recommend that you try XAMPP quickly install the configuration method, the use is also very convenient and quick, click on the previous hyperlink or Google a bit to know how to use.

?

There is also a more simple one-click installation method:

?

? wangking wrote

One-click installation lamp Service:
sudo tasksel install Lamp-server

One click to uninstall lamp:

sudo tasksel remove Lamp-server

Attention:

Uninstalling the lamp from the above command would inevitably unload the Linux system itself, so

always remember to update the system after you uninstall the lamp:

sudo apt-get update

sudo apt-get upgrade

All two of the above will be executed.

?

?

  • Related Article

    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.