Install PHP under Ubuntu

Source: Internet
Author: User
Install PHP under Ubuntu

Installing the Apache2:sudo apt-get install apache2. To see if it was successful: http://localhost/
Installing Php5:sudo apt-get Install PHP5
sudo apt-get install libapache2-mod-php5 (according to my actual test, this step does not seem to be done, in the previous step has been installed, but it is recommended that you copy/paste this command)
Sudo/etc/init.d/apache2 Restart test if the PHP5 installation was successful
sudo gedit/var/www/testphp.php
Write in, then open in Firefox: http://localhost/testphp.php

Installing Mysql:sudo apt-get Install Mysql-server

MySQL initially allows only native (127.0.0.1) connections, and if you want to use multiple machines or open to the Internet, edit/etc/mysql/my.cnf
sudo gedit/etc/mysql/my.cnf
Find bind-address = 127.0.0.1, comment out with #, like this: #bind-address = 127.0.0.1

MySQL default does not set the root password, the root user of this machine has no password, there is a risk, right, so
Mysqladmin-u Root Password Your-new-password
Mysqladmin-h root@local-machine-name-u root-p Password Your-new-password (here I can not connect to MySQL server, finally changed in Mysql-admin)
Sudo/etc/init.d/mysql restart

Installing MySQL administrator:sudo apt-get install mysql-admin

Installing MySQL for Apache HTTP Server
sudo apt-get install Libapache2-mod-auth-mysql
sudo apt-get install Php5-mysql

(sudo apt-get install phpmyadmin)

To have PHP work with MySQL, edit
sudo gedit/etc/php5/apache2/php.ini
To cancel a comment on; extension=mysql.so, like this.
...
Extension=mysql.so
...

Save the file, and then
Sudo/etc/init.d/apache2 restart

Test:
Http://localhost/phpmyadmin

  • 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.