Build the ubuntuphp environment 1. install apache
Sudo apt-get install apache2
Modify the path of the default website root directory Apache's first configuration file apache2.conf
/Etc/apache2/apache2.conf
Path of the second Apache configuration file 000-default.conf
/Etc/apache2/sites-available/000-default.conf
Change the path to/var/www/
DocumentRoot /var/www/html
2. install php5
Sudo apt-get install php5
3. installing pdo mysqlPDO (PHP Data Object) is a new database processing method of PHP 5. due to the conflict between php License and myslq license, PHP may not be bound to mysql in subsequent versions. Php_mysql.dll may not be supported by default. Pdo is a pecl.php.net project. you can use pear to install pdo first.
Apt-get install php-pearsudo apt-get install php5-devsudo apt-get install libmysqlclient15-dev
Then you can install pdo.
Pecl search pdosudo pecl install pdo_mysql
The following error is reported:
The above indicates that the pdo_mysql driver cannot be found in pear, and the php5-mysql needs to be reinstalled
Sudo apt-get install php5-mysql
After the installation is successful, the system runs normally. Although we seem to have installed the php5-mysql in apt, but here you still need to install again finally, modify
/Etc/php5/apache2/php. ini
Add Code
extension=pdo.soextension=pdo_mysql.so
In this way, you can connect to mysql through php5.