Problems encountered during lamp environment setup

Source: Internet
Author: User
: This article mainly introduces the problems encountered during lamp environment setup. For more information about PHP tutorials, see. The following steps and problems are involved in migrating the project made by wamp to the lamp environment.

I have not installed the lamp environment on the internet. The following is an online tutorial and my problems and solutions.

Step 1 installApache2
Sudo apt-get installApache2
Step 2 install the PHP module
Sudo apt-get install php5
Step 3 install Mysql
Sudo apt-get install mysql-server
Sudo apt-get install mysql-client
Step 4 install other modules
Sudo apt-get install libApache2-mod-php5
Sudo apt-get install libApache2-mod-auth-mysql
Sudo apt-get install php5-mysql
Sudo apt-get install php5-gd
Step 5 testApacheNormal operation?
Open your browser and enter localhost to check whether It Works exists! Webpage display. Directory:/var/www
Step 6 modify permissions/var/www
Sudo chomod 777/var/www
Step 7 installPhpmyadmin
Sudo apt-get installPhpmyadmin
SelectApache2. click OK. The next step is to configure the database and enter the password.
Step 8 testPhpmyadmin
Sudo ln-s/usr/share/Phpmyadmin/Var/www
Then run http: // localhost/PhpmyadminSee if any database management software is available.
Configuration process
Step 1 enable the mod_rewrite module
Sudo a2enmod rewrite
RestartApacheServer: sudo/etc/init. d/Apache2 restart or sudo serviceApache2 restart
Step 2 settingsApacheSupport for .htm. html. php
Sudo gedit/etc/Apache2/Apache2. conf &
Add the following sentence: AddType application/x-httpd-php. php. htm. html
Step 3 test the php webpage
Edit the mysql_test.php code as follows:
$ Link = mysql_connect ("localhost", "root", "password ");
If (! $ Link)
Die ('could not connect: '. mysql_error ());
Else
Echo "Mysql configuration is correct! ";
Mysql_close ($ link );
?>
When you access http: // localhost/mysql_test.php, 'MySQL configuration is correct 'indicates that the configuration is correct.
Step 4, step 3, the solution after garbled characters appear
Open the configuration file sudo gedit/etc/Apache2/Apache2. conf &
Add the code below: AddDefaultCharset UTF-8
So far, the configuration is OK.

Problems and Solutions:

1. the software cannot be downloaded. this is the software source. you can modify the software source in the Software Center. some select the primary server. some select the Chinese server. you can download the software from either of the two combinations.

2, sudo apt-get install libApacheInstall sudo apt-get install before 2-mod-php5Apache2-mpm-itk replace the software source if it cannot be downloaded

3, install php5-cli otherwise enter php in the terminal will prompt no corresponding command

The above describes the problems encountered in the lamp environment setup, including Apache, phpmyadmin, and Apache installation. I hope my friends who are interested in the PHP Tutorial can help me.

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.