Ubuntu lamp (apache + mysql + php) Environment setup I. Environment installation 1. install apache2 sudo apt-get install apache2 and open http: // localhost/or http: // 127.0.0.1 in the browser! Verify that apache is successfully installed. Www.2cto.com 2. install PHP sudo apt-get install php5 sudo apt-get install libapache2-mod-php5 sudo/etc/init. d/apache2 restart
Test: Writing sudo vi/var/www/testphp. php to php works! Save and exit vi. Then input http: // 127.0.0.1/testphp. php or http: // localhost/testphp. php In the browser If php works is displayed! Indicates that the php configuration is successful. 3. install MYSQL sudo apt-get install mysql-server and set the root password as prompted during installation.
Note: change the password: mysql-uroot-p mysql> use mysql; mysql> update user set PASSWORD = password ('new password') WHERE user = 'root '; mysql> exit to restart mysql, or refresh the permission to restart: sudo/etc/init. d/mysql restart or restart mysql
4, let apache, php support mysql sudo apt-get install libapache2-mod-auth-mysql sudo apt-get install php5-mysql sudo/etc/init. d/apache2 restart now Ubuntu + apache2 + php 5 + mysql installation is complete. Tip:/etc/apache2/: 1. apache2.conf is the main configuration file, httpd. conf user configuration file 2. The virtual directory is in httpd. in the conf file, DocumentRoot "path" ServerName # Listen 127.0.0.1: 80 # note that you cannot write a listener in this file. If you must write a listener, you need to first include/etc/apache2/ports under apache2.conf. conf to comment out, because ports. port 80 has been monitored in conf
3. Set the directory to/etc/apache2/sites-enabled/000-default. You can set the VM 4 and php. ini:/etc/php5/apache2/php. ini 5, mysql. cnf:/etc/mysql/my. cnf 4. Restart apache:/etc/init. d/apache2 restart 5. restart mysql: sudo/etc/init. d/mysql restart or restart mysql 6. log File:/var/log/apache2/
Ii. install sudo apt-get install php5-gd sudo/etc/init in GD library. d/apache2 restart 3. curl extension install sudo apt-get install php5-curl sudo/etc/init. d/apache2 restart