Install PHP-Fusion 7 on a CentOS 7 VPS
In this tutorial we will install PHP-Fusion 7 on a CentOS 7 VPS with Apache, MariaDB and PHP.
PHP-Fusion 7 is built to run on most configurations, but still your server needs to meet the following requirements:
PHP version 5.3.4 or higher
MySQL version 4.1 or higher
First of all, log in to your CentOS 7 VPS and make sure that all installed packages are up tp date
yum -y update
We need to have a LAMP stack in order to run PHP-Fusion, so first we will install Apache web server, MariaDB and PHP.
MariaDB is the default database server in CentOS 7 and it can be installed using the yum command.
yum install mariadb mariadb-server
Start the MariaDB service and enable it to start at boot
systemctl start mariadb.service systemctl enable mariadb.service
Once MariaDB is installed, run the following post-installation script in order to secure your database server and set a root password
and use the following options
- Set root password? [Y/n] y - Remove anonymous users? [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
New, we will install Apache web server
yum install httpd
Start the web server and enable it to start at boot
systemctl start httpd systemctl enable httpd
PHP-Fusion is a PHP based application so we need to install PHP
yum install php php-mysql
Restart the Apache web server for the changes to take effect
systemctl restart httpd
Now we have a fully functional LAMP stack installed on our CentOS 7 server and we can start with the PHP-Fusion installation.
Download the latest stable version of PHP-Fusion on your server
Unpack the downloaded zip archive
yum install unzip unzip PHP-Fusion-7.02.07.zip
Create a directory for your new PHP-Fusion website in the document root directory on your server
Copy the PHP-Fusion files from the unpacked directory to the newly created mywebsite.com directory
cp -R PHP-Fusion-7.02.07/files/* /var/www/html/mywebsite.com/
Rename the PHP-Fusion configuration file
Rename the created directory
mv _config.php config.php
and change the owner of the PHP-Fusion files
chown -R apache:apache /var/www/html/mywebsite.com/
Next, login to your MariaDB server as user root and create a new database and user
mysql -u root -p MariaDB [(none)]> CREATE DATABASE phpfusion; MariaDB [(none)]> GRANT ALL ON phpfusion.* to [email protected] identified by 'YOURPASSWORD'; MariaDB [(none)]> FLUSH PRIVILEGES; MariaDB [(none)]> \q
Don’t forget to replace ‘YOURPASSWORD’ with an actual strong password.
Now, we will set up Apache virtual hosting directive for the ‘yourdomain.com’ domain name.
Create a ‘/etc/httpd/conf.d/vhosts.conf’ file with the following content
vim /etc/httpd/conf.d/vhosts.conf IncludeOptional vhosts.d/*.conf
Create a ‘/etc/httpd/vhosts.d’ directory where we will put all our virtual hosts.
Create a virtual host for our domain
cd /etc/httpd/vhosts.d vim yourdomain.com
and add the following content
<VirtualHost YOUR_SERVER_IP:80> ServerAdmin [email protected] DocumentRoot "/var/www/html/yourdomain.com" ServerName yourdomain.com ServerAlias www.yourdomain.com ErrorLog "/var/log/httpd/yourdomain.com-error_log" CustomLog "/var/log/httpd/yourdomain.com-access_log" combined <Directory "/var/www/html/yourdomain.com/"> DirectoryIndex index.php Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost>
That’s all. The installation from the command line is completed. Now, head your favorite web browser to http://yourdomain.com and follow the instructions to finish the installation.
Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install PHP-Fusion for you. They are available 24×7 and will take care of your request immediately.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.