Install Apache, Mysql, and PHP in CentOS6. 1. install Apache
Enter the following command in the terminal to install Apache:
sudo yum install httpd
Sudo indicates what operations are performed by the root user. Click y to download and install it, which is very convenient.
Run the following command to start the service:
sudo service httpd start
Now you don't have to worry about it. simply enter the IP address that DigitalOcean gave you in your browser and you will be able to access the Apache welcome page. Similar to the following:
Is it cool? If your domain name has been successfully resolved to the IP address of your host, you should be able to access it with your domain name!
2. install Mysql
sudo yum install mysql-serversudo service mysqld start
Use the following command to download and install mysql. The second one is to start the mysql service.
After installing mysql, you will be asked about some simple configurations. press enter first. the following English is actually very simple. you can choose one based on your needs.
Disallow root login remotely? There is such an option: whether to allow remote access by the mysql root user. I chose no to allow remote access, which is more convenient, but there is a security risk. In this case, you can also use the database in the VPS.
3. install PHP and PHP components
sudo yum install php php-mysql
Use the above command to download and install PHP. It is troublesome to use PHP components.
yum install php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
I have installed seven simple components here. you can also search for all PHP components and use the following command
yum search php-
4. start Apache and Mysql services by default.
sudo chkconfig httpd onsudo chkconfig mysqld on
You can use the preceding two commands to start Apache and Mysql at startup.
5. test whether PHP is successfully installed.
sudo nano /var/www/html/info.php
You can use the following command to create a new info. php file. nano is a simple text editing tool and vim.
Enter a simple PHP test command:
Then press Ctrl o to save the settings and press enter to confirm. Press Ctrl x to exit.
In the browser, enter the IP address and add info. php to view the PHP information! Similar to the following figure:
I'm so excited to install Wordpress.
Reference;
Install Apache, Mysql, and PHP in CentOS 6