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 Nette PHP Framework in CentOS 7.
Install Nette PHP Framework on CentOS 7
Step 1. First we need to add EPEL repository in 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
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.
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 following command to update it to latest version for composer:
You can also check the version of composer by running bellow command:
Step 4. Create Nette Application.
Let’s navigate to web document root and use composer to create a new nette application using following commands:
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 Nette framework on your localhost system. Open your favorite browser and navigate to http://localhost/myapp/www/ and complete the required the steps to finish the installation.
Step 5. Configuring Apache web server for Nette.
We will create 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:
Next, create the virtual host:
Add the following lines:
CustomLog "/var/log/httpd/yourdomain.com-access_log" combined
DirectoryIndex index.html index.php
Require all granted
Save and close the file. Restart the apache service for the changes to take effects:
systemctl restart httpd.service
Congratulation’s! You have successfully installed Nette PHP Framework. Thanks for using this tutorial for installing Nette PHP Framework on your CentOS 7 system. For additional help or useful information, we recommend you to check the official Nette PHP Framework web site.