Install Apache PHP MySQL CentOS 6
On most of our Linux VPS Server, Apache is installed by default. So, you can easily see if apache is installed and running by just visiting your IP address in a browser. Should Apache PHP Mysql not be installed to your CentOS 6 server. Issue the below install commands.
Install Apache, MySQL and PHP on CentOS 7 Servers
Install Apache
install httpd -y
service httpd start

Ensure port 80 is open in your server’s firewall. If not, use the commands below to open the port.
/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/etc/rc.d/init.d/iptables save
Install MySQL
To install MySQL;
yum install mysql-server
service mysqld start
When you have installed MySQL and started it. Run the post install script.
/usr/bin/mysql_secure_installation
You will be asked for the current root password, leave this blank by just hitting enter then, set a new MySQL root password.
Set root password? [Y/n] Y
New password: YourMySQLPassword
Re-enter new password: YourMySQLPassword
Select the following options when promoted too.
Remove anonymous user? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
Install PHP
The default PHP version in yum is currently PHP 5.3 but this is end of life so we are going to use new RPMs to install a newer version of PHP to your Linux VPS Server. Copy the below code into your SSH console;
wget http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm ; wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm ; rpm -Uvh epel-release-6-8.noarch.rpm remi-release-6.rpm
Next, install Yum Utils which we will use to enable the remi repository
yum install yum-utils
To Intall PHP 7.4, 7.2 or 6.4
yum-config-manager --enable remi-php74
yum-config-manager --enable remi-php72
yum-config-manager --enable remi-php64
Once installed you can then install any required PHP module by issuing the correct commands in the SSH console, for example
yum install php php-cli php-mcrypy php-curl php-gd php-mysql php-zip php-ldap php-fileinfo
Video Tutorial
How was this article? – Install Apache PHP MySQL CentOS 6
You might also like
More from All About Linux
How to install FTP and configure FTP on an Ubuntu 22 LTS instance
If you need to upload files to your NVMe VPS you have a couple of options. You can use a …
How to install a Cloudflare Origin SSL Certificate – NGINX
An SSL Certificate is vital to encrypt data between you and your clients. SSLs can be complicated things. If they …
How To Open Port FirewallD and Close Port FirewallD -CentOS 7
Open And Close Ports In FirewallD - Manage Zones In FirewallD Like IPtables, FirewallD is a Linux firewall that filters packets …
1 Comment
[…] You have now updated your MySQL root password. Ensure you keep a secure copy of your MySQL root password or you may need to change it again. For details on installing MYSQL, PHP and Apache on CentOS6 you can use this guide […]