"Linux" in Ubuntu layout lamp environment

Source: Internet
Author: User
Tags php and mysql import database mysql export database phpmyadmin

It is said that doing good lamp is linux+apache+mysql+php equivalent to an intermediate PHP program ape level, of course, your PHP is going to do, after all the framework. In fact, this thing is not mysterious, very simple. Even simpler than windows, a variety of variables automatically help you do well. Your fear comes mainly from your ignorance.

It is recommended to first through the phpnow1.5.6 in Windows one key to the PHP environment, and then through the Mysql_gui_tools graphics MySQL, the PHP project written, PHP project, MySQL database import and export to Linux run, Linux is purely a running project, do not do development.

First, lamp download, installation and configuration

After you install Ubuntu, the installation of Ubuntu specifically see: "Linux" Ubuntu12.04 Download and installation (click to open the link), plug the network cable, and then follow the steps below to install the remaining amp:

1, Ctrl+alt+t Open the terminal, enter the following instructions:

sudo apt-get install apache2 mysql-server mysql-client php5 php5-gd php5-mysql

2, press ENTER, input y, wait for a short time, only 35M things quickly under good, not to foreign sites, is the normal speed download. If an error occurs, your Ubuntu hardware driver is not ready, and the virtual machine is your VMware tools and so on, the problem is solved after reloading.

3, then is about 15 minutes of waiting, see the speed bar. Directly on the brush screen.

4, Midway request you to set up the MySQL password, this password is well written. Requirements set two, one is Mysql-server, the other is mysql-client, but also you have to determine the password, a total of four times, the key is that your network engineering connection database password is the same. Get a root.

5, and then continue to wait for its download, installation completed.

6, because most of the lamp operation and/var/www directory-related, for convenience, modify the permissions of the directory for ordinary users can access. Continue to enter the following command at the terminal:

sudo chmod 777/var/www/
After the loss, all sudo commands to password, annoying!

7, after the installation of a component phpMyAdmin, enter the following statement, press Y to install:

sudo apt-get install phpMyAdmin

8, in the installation process will be required to select the Web Server:apache2 or LIGHTTPD, the default selection apache2 press OK. The one with the lamp!

9, the agreement and so on, not to look at, must be.

10, and then set the phpMyAdmin password, continue to root got.

After 11, to establish the connection between the phpMyAdmin and apache2, enable the Apache mod_rewrite module, and reboot Apache2 complete the configuration, so continue to enter the following statement:

sudo ln-s/usr/share/phpmyadmin/var/wwwsudo a2enmod rewritesudo/etc/init.d/apache2 Restart

12, after also set a good apache2 default code, otherwise garbled. Enter the following command at the terminal:

sudo gedit/etc/apache2/apache2.conf

13, in the pop-up text editing window, pull to the last line input as follows Adddefaultcharset UTF-8 Save exit, in fact/etc/apache2/apache2.conf is Apache2 configuration file!

14, then enter the download instructions to restart Apache, that is, just configure phpMyAdmin to restart the apache2 server instructions, to here the whole lamp has been set up!

Sudo/etc/init.d/apache2 restart

Second, test and Hello World

After the lamp is ready, it is best to restart Ubuntu to do the following test, in fact, no restart is not a problem. The most feared is that some of the small problems caused by the failure to restart.

1, directly open the Ubuntu file system, into the var/www, right-click on the inside to create a new document--blank document. Create a new blank document. Your PHP project will be copied directly here. It can be executed.

2. Name this blank document as test.php

3, open test.php in the inside input the following things, in fact, is a simple PHP connection MySQL program:

<?php$link = mysql_connect ("localhost", "root", "MySQL password"), if (! $link) {die (' Could not connect: '. Mysql_error ());} else echo "MySQL is configured correctly"; Mysql_close ($link);? >
Used to verify that PHP and MySQL are connected successfully, save exit.

4, finally, open the left test of the Ubuntu Quick Start bar, open your own wild Fox Zen Browser, in the address bar input you can see "MySQL has been properly configured" output. Obviously, if you copy PHP project A's folder to Var/www, then in the Address bar, enter

5, in addition, at this time because MySQL has been installed, and automatic configuration, at the Ubuntu terminal, enter the following instructions to enter MySQL:

Mysql-u root-p

What to do afterwards, you know. Whether it is to create a user or, specifically, "MySQL" to modify the root password and create an account with the same privileges as root (click the open link), or you are in the windows of the Project Guide, see "MySQL" MySQL Export database and import Database (Click to open the link), do whatever you want to do anyway.

As for the installation of PHP in Ubuntu Ide--aptana, the pro-test found that I do not know why the mess is not good. Mysql_gui_tools is a problem with that.

Therefore, the development, or choose their most comfortable system. Anyway, Windows development and Linux are not writing the same statement, there is no professional unprofessional.

"Linux" in Ubuntu layout lamp environment

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.