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 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
To install MySQL;
yum install mysql-server service mysqld start
When you have installed MySQL and started it. Run the post install script.
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
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
How was this article? – Install Apache PHP MySQL CentOS 6
You might also like
More from All About Linux
Open And Close Ports In FirewallD - Manage Zones In FirewallD Like IPtables, FirewallD is a Linux firewall that filters packets …