Nette is a PHP Framework getting popularity world-wide. As per SitePoint’s survey Nette is 3’rd most popular PHP framework used for web development. This tutorial will help you to install Nette PHP Framework on CentOS, Red Hat & Fedora operating systems.
Step 1: Setup Yum Repositories
First you need to add REMI and EPEL rpm repositories in your system. these repositories have updated packages. Use one of the below command as per your OS version and system architecture.
CentOS/RHEL 7, 64 Bit System:# rpm -Uvh http://free.nchc.org.tw/fedora-epel/7/x86_64/e/epel-release-7-5.noarch.rpm # rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm CentOS/RHEL 6, 32 Bit System:# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm # rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm CentOS/RHEL 6, 64 Bit System:# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm # rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm CentOS/RHEL 5, 32 Bit System:# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm # rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm CentOS/RHEL 5, 64 Bit System:# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-releas5-4.noarch.rpm # rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
Step 2: Install Apache, MySQL and PHP
To start with Nette configuration, we first need to setup a running LAMP server. If you have already running LAMP stack skip this step else use followings commands to setup lamp stack.
# yum --enablerepo=remi,epel install httpd
# yum --enablerepo=remi,epel install mysql-server # service mysqld start # /usr/bin/mysql_secure_installation
# yum --enablerepo=remi,epel install php php-mysql php-mcrypt # service httpd restart
Step 3: Install or Update Composer
Composer is required for installing Nette framework. So use below commands to download and use as a command in our system.
# curl -sS https://getcomposer.org/installer | php # mv composer.phar /usr/local/bin/composer # chmod +x /usr/local/bin/composer
If you already have composer installed on your system. Use following command to update it to latest version.
# composer self-update
Step 4 – Create Nette Application
Let’s navigate to web document root and use composer to create a new nette application using following commands. It will automatically download latest copy of Nette framework on your system under mypp directory.
# cd /var/www/html # composer create-project nette/sandbox myapp
After successfully downloading all packages, assign proper permissions on file and folders in your application.
# 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 system.
Step 6 – Create Apache VirtualHost
Now add a Virtual Host in your Apache configuration file to access Nette PHP framework from web browser. To do it edit Apache configuration file /etc/httpd/conf/httpd.conf and add below code at end of file
# vim /etc/httpd/conf/httpd.conf
<VirtualHost *:80> ServerName nette.example.com DocumentRoot /var/www/html/nette/www <Directory /var/www/html/nette/> AllowOverride All </Directory> </VirtualHost>
Restart Apache service and access Nette framework using your favourite web browser and start developing a great web application.
# service httpd restart