Generally, sudoapt-getinstallXXXXXXX 1 is used. run the following command to install PHP + MYSQL + Apache on Ubuntu in apt-get mode: (1) install MYSQLsudoapt-getinstallmysql-serversudoapt-getinstallmysql-client (2) install Apachesudoapt-getins
Generally, sudo apt-get install XXXXXXX is used.
1. Use apt-get to install PHP + MYSQL + Apache for Ubuntu
Run the following commands:
(1) install MYSQL
Sudo apt-get install mysql-server
Sudo apt-get install mysql-client
(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) install phpmyadmin
Sudo apt-get install phpmyadmin
During the installation process, You must select Web server: apache2 or lighttpd, select apache2, press the tab key, and click OK. Then, you are required to enter the Mysql database Password of the database's administrative user.
Then, establish a connection between phpmyadmin and apache2. Take my example: the www directory is in the/var/www directory, and the phpmyadmin directory is in the/usr/share/phpmyadmin directory. Therefore, run the following command:
Sudo ln-s/usr/share/phpmyadmin/var/www
Establish a connection.
Phpmyadmin test: Open http: // localhost/phpmyadmin in the address bar of the browser.
Check whether the installation is successful:
(1) Check whether Mysql is normal
Enter mysql-u username-p password in the terminal (replace username and password with the one you set) to check whether the logon is successful.
(2) 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.
(3) Check whether PHP is normal
The default installation path of Apache in Ubuntu is/var/www/. Create the info. php file in the directory. The file content is:
Phpinfo ();
?>
Then open http: // localhost/info. 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:
Sudo chmod 777/var/www
(4) Chinese garbled characters in the browser PHP
If Chinese characters are garbled during the test. php test in the FireFox browser, the default language settings are incorrect. The solution is as follows:
Open the apache configuration file sudo gedit/etc/apache2/apache2.conf and add the AddDefaultCharset UTF-8 at the end
Restart Apache: sudo/etc/init. d/apache2 restart and refresh test. php.