Because Ubuntu is installed on the machine and you are very interested in PHP, you have been trying to build a PHP development environment under ubuntu, that is, for Linux + Apache + MySQL + PHP, there are many silly installation packages for building WAMP due to win operating systems. However, in Linux, it is a little complicated to build such environments, in the spirit of tossing to death, the phone bill for several hours, finally successfully set up the LAMP environment: Set up preparations to ensure that your machine is connected to the Internet to open the terminal (ctrl + al
Because Ubuntu is installed on the machine and you are very interested in PHP, you have been trying to build a PHP development environment under ubuntu, that is, for Linux + Apache + MySQL + PHP, there are many silly installation packages for building WAMP due to win operating systems. However, in Linux, it is a little complicated to build such environments, in the spirit of tossing to death, the phone bill for several hours, and finally successfully set up the LAMP environment:
Preparation
Make sure your machine is connected
Open the terminal (ctrl + alt + t)
Www.linuxidc.com @ ubuntu :~ $
Enter the following command directly.
(1) install MYSQL
Sudo apt-get install mysql-server
Sudo apt-get install mysql-client
During the installation process, you will be prompted to set the user and password. For example, if both my user and password are root
(2) install Apache
Sudo apt-get install apache2
(3) install PHP
Sudo apt-get install php5
Sudo apt-get install libapache2-mod-auth-mysql
Sudo apt-get install php5-mysql
(4) Verify Installation
Enter mysql-uusername-ppassword in the terminal to replace username and password with the value you set.
Mysql-uroot-proot
If
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 56
Server version: 5.1.58-1ubuntu1 (Ubuntu) indicates that Mysql is successfully installed.
(5) Check if Apache is normal
Open http: // localhost/in the browser/
If the following information appears, it indicates normal.
It works!
This is the default web page for this server.
The web server software is running but no content has been added, yet.
(6) Check whether PHP is normal
The default installation path of Apache in Ubuntu is/var/www/. Create a hello. php file in the directory with the following content:
Echo "hello, world! ";
?>
Then open http: // localhost/hello. php In the browser to check whether it is normal.
Note: You do not have permission to directly create a file in this directory. Add the current user permission to the file:
Su root (root User)
Chown username/var/www (replace username with your current user name)
Exit (exit root)
If the root user of your Ubuntu system is not available, it is because the default root password of the ubuntu system is empty. You can set the password using the following command:
Use sudo-I to enter the # prompt, and enter passwd root to enter the new password!