In this tutorial, we will show you how to install and configuration of Nette PHP Framework on your CentOS 7 server. For those of you who didn’t know, Nette Framework is a popular tool for PHP web development It is designed to be as usable and as friendly as possible. It focuses on security and performance and is definitely one of the safest PHP frameworks. Nette Framework speaks your language and helps you to easily build better websites.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you through the step by step installation of Nette PHP Framework in CentOS 7.
Install Nette PHP Framework on CentOS 7
Step 1. First, we need to add EPEL repository to our system.
yum install epel-release yum -y update
Step 2. Install LAMP server.
A CentOS 7 LAMP server is required. If you do not have LAMP installed, you can follow our guide here.
Step 3. Install Composer.
Download and install Composer by executing the following command:
curl -sS https://getcomposer.org/installer | php
[root@idroot ~]# curl -sS https://getcomposer.org/installer | php #!/usr/bin/env php Some settings on your machine may cause stability issues with Composer. If you encounter issues, try to change the following: Your PHP (5.3.3) is quite old, upgrading to PHP 5.3.4 or higher is recommended. Composer works with 5.3.2+ for most people, but there might be edge case issues. Downloading... Composer successfully installed to: /root/composer.phar Use it: php composer.phar
Once the process completes, you can make the ‘composer.phar’ file executable by running the following command:
chmod +x composer.phar
Now use the following commands to make composer available globally for all users in your system, which can be used for all php applications on that system:
mv composer.phar /usr/local/bin/composer
Use the following command to update it to the latest version for the composer:
You can also check the version of the composer by running the bellow command:
Step 4. Create Nette Application.
Let’s navigate to web document root and use composer to create a new nette application using the following commands:
cd /var/www/html composer create-project nette/sandbox myapp
We will need to change some folders permissions:
chown -R apache.apache myapp chmod -R 755 myapp chmod -R 777 myapp/tmp myapp/log
Step 5. Access Nette Application.
At this stage, you have successfully configured the Nette framework on your localhost system. Open your favorite browser and navigate to http://localhost/myapp/www/ and complete the required steps to finish the installation.
Step 5. Configuring Apache web server for Nette.
We will create an Apache virtual host for your Craft CMS website. First create ‘/etc/httpd/conf.d/vhosts.conf’ file with using a text editor of your choice:
nano /etc/httpd/conf.d/vhosts.conf IncludeOptional vhosts.d/*.conf
Next, create the virtual host:
mkdir /etc/httpd/vhosts.d/ nano /etc/httpd/vhosts.d/yourdomain.com.conf
Add the following lines:
<VirtualHost YOUR_SERVER_IP:80> ServerAdmin email@example.com DocumentRoot "/var/www/html/nette/www" 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/nette/"> DirectoryIndex index.html index.php Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost>
Save and close the file. Restart the apache service for the changes to take effects:
systemctl restart httpd.service
Congratulations! You have successfully installed Nette PHP Framework. Thanks for using this tutorial for installing the Nette PHP Framework on your CentOS 7 system. For additional help or useful information, we recommend you to check the official Nette PHP Framework website.