ubuntu-server14.04 Building Lamp Environment

Source: Internet
Author: User
Tags php and mysql phpinfo

Transferred from: http://www.cnblogs.com/myzhibie/p/4330327.html

For many PHP beginner developers, to build a lamp environment can be used for production is a time-consuming and laborious thing, this article takes ubuntu-server14.04 as an example, gives a tutorial to build the environment for everyone to reference;

1. Update the SOFTWARE source

sudo  apt-get update

2. Installing Apache

sudo apt-get  install apache2

3. See if Apache is installed successfully

Apache2–v

As shown below, indicates a successful build

4. Access the server's IP through the browser, if an Apache welcome interface appears, the installation succeeds as follows:

5. Installing PHP5

Install PHP5

6. View the version of PHP5

Php5–v

Indicates that the PHP5 has been installed successfully.

7. Check to see if Apache has loaded the Libphp5.so module, a module that Apache uses to command PHP parsers to execute PHP code.

Cat/etc/apache2/mods-enabled/php5.load

Indicates that the module has been loaded

8. Install MySQL, the installation process will let the input database root user password, two times input can continue installation to complete, note that this password is not the system root account password, but the database you installed the default user root password

Install Mysql-server

9. Check if mysql.so extension is loaded, PHP performs curd operation via the extension link MySQL, if prompt no such file or directory means PHP does not have an extension of the operational database installed by default, it needs to install itself

Cat/etc/php5/mods-available/mysql.ini,

10. If the previous step is unsuccessful, perform this step to install the MySQL extension for PHP

Install Php5-mysql

11. See if the extension is installed successfully, the different versions may be stored in different locations

Cat/etc/php5/mods-available/mysql.ini

Indicates that the mysql.so extension has been installed successfully.

12. Restart MySQL and Apache

sudosudo service apache2 restart

13. Create a PHP file to test if the environment is installed successfully.

cd/var/www/info.php

PHP File Contents:

mysql_connect (' localhost ', ' root ', ' 123456 ')? "Success"    :"fail";  Phpinfo (); 

Note that you must use the LocalHost address as the address of the test database connection, because so far we have not opened the account service for MySQL remote connection.

14. Access the file ip/info.php to see if the connection was successful

Indicates a successful connection, so far our PHP and MySQL as well as Apache have been installed and have been configured to work properly.

15. Install Common Extensions for PHP

Install Php5-gd Curl Libcurl3 Libcurl3-dev Php5-curl

The installation time of the process is longer, please wait patiently;

16. After the installation is complete, restart Apache

sudo service apache2 restart

17. Back to the browser info.php refresh, to see if the expansion just installed is loaded, search Gd,curl, etc., if the installation was successful, should be able to display in the phpinfo loaded;

18. If you need to upload or manipulate files, you need to use the root account for SSH login, you need to modify the Ubuntu system allows the root user ssh login,

cd/etc/ssh/   sudo vim sshd_config  : Set nu  28G  

Find Permitrootlogin instead of Yes to save the exit, restart the SSH service, you can use the root account login.

SSH restart

19. Install the phpMyAdmin (preferably installed, easy to operate and set the remote login account behind)

Install phpMyAdmin

The installation process will prompt for a password, etc., directly input can be installed by default in the/usr/share/phpmyadmin directory, in order to enable us through the Web Access, here need to establish a soft connection to the Apache default directory

Ln-s/USR/SHARE/PHPMYADMIN/VAR/WWW/HTML/PMA

Here we have established a PMA soft connection pointing to the actual phpMyAdmin directory.

20. Directly access phpMyAdmin in the browser, enter IP/PMA as follows:

Enter the user name password to log in.

21. Turn on MySQL remote access permission,

sudo  vim/etc/mysql/my.cnf

Find Bind-address, comment out it, save exit, then log in to phpMyAdmin, create a new user in the permissions, as follows:

Finally restart the MySQL service

sudo service MySQL restart

This allows MySQL to be connected via remote connection tools such as Navicat, so that a simple lamp environment can be built successfully.

Transferred from: http://www.cnblogs.com/myzhibie/p/4330327.html

ubuntu-server14.04 Building Lamp Environment

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.