Home > Article > Backend Development > How to install php environment on 32-bit ubuntu
How to install the PHP environment on 32-bit Ubuntu: 1. Open the command line and obtain the software package; 2. Install the MySQL database; 3. Install the Apache server; 4. Install PHP through sudo apt-get install, and Just let Apache support PHP.
The operating environment of this article: ubuntu 16.04 system, PHP5 version, DELL G3 computer
How to install the php environment in 32-bit ubuntu?
The establishment of PHP environment (LAMP) under Ubuntu 12.04 (32-bit)
The default installation under Ubuntu 12.04 32-bit is 5.3.10. It is not the following picture and text 5.4
1. First open the command line, switch to root identity, and get the latest software package
su root sudo apt-get install update
2. Install the MySQL database
sudo apt-get install mysql-server mysql-client
The picture below shows the prompt to enter the database password, and then press Enter. There will be a prompt after that. Enter it again and press Enter
After the installation is completed, enter the database to test whether the installation is successful. Once you see the welcome message, it will be ok.
mysql -uroot -p ***
Run the security wizard command:
sudo /usr/bin/mysql_secure_installation
3. Install the Apache server
sudo apt-get install apache2
After the installation is complete, test it and enter http://localhost/ or http in the browser ://127.0.0.1/
If "It works!" appears, it means the installation is successful.
4. Install PHP and let Apache support PHP
sudo apt-get install php5 libapache2-mod-php5
After the installation is complete, restart the Apache server
sudo /etc/init.d/apache2 restart
Then enter Apache’s www folder (default is in /var ), create the phpinfo.php file
cd /var/www ls vi phpinfo.php
and then write
<?php phpinfo(); ?>
in the phpinfo.php file. But we may not be able to save it after we finish writing, because we are now dealing with the files in the www directory. There is no write permission, so we first authorize all files in the www folder, and then we write the code.
chmod 777 /var/www/
Finally enter http://localhost/phpinfo.php in the browser, and you can see the php information
But at this time, you cannot connect to the database, and the corresponding module cannot If it is not installed, then let’s look at step 5
5, the installed php-mysql software package and some other commonly used modules
sudo apt-get install php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
Then visit http://localhost/phpinfo again .php (it’s best to restart Apache first), then we can see the modules we added
6. Install phpMyAdmin
We can easily manage our MySQL database through phpMyAdmin
sudo apt-get install phpmyadmin
During the installation process, the following choices will appear, asking if you want to configure phpmyadmin. We select "YES"
and then you need to enter the MySQL password until the installation is completed.
Then visit http://localhost/phpmyadmin and you will reach the login interface of phpMyAdmin
Recommended learning: "PHP Video Tutorial"
---------------------------- ------------------------------------------
upgrade to The latest version of php
sudo add-apt-repository ppa:ondrej/php5 sudo apt-get update sudo apt-get install php5 #php -v #查看php版本号 PHP 5.5.3-1+debphp.org~precise+2 (cli) (built: Aug 27 2013 09:14:56) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
The above is the detailed content of How to install php environment on 32-bit ubuntu. For more information, please follow other related articles on the PHP Chinese website!