How To Setup Nette PHP Framework on Ubuntu & LinuxMint

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 setup Nette PHP Framework on Ubuntu, Debian & LinuxMint operating systems.

Step 1 – Install LAMP

First start with the installation of LAMP server on your system. If you have already running LAMP stack skip this step else use followings commands to set up lamp on Ubuntu system.

Install PHP 5.5

$ sudo apt-get install python-software-properties $ sudo add-apt-repository ppa:ondrej/php5 $ sudo apt-get update $ sudo apt-get install -y php5 php5-mcrypt php5-gd 

Install Apache2

$ apt-get install apache2 libapache2-mod-php5 

Install MySQL

$ apt-get install mysql-server php5-mysql 

Step 2 – 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 $ sudo mv composer.phar /usr/local/bin/composer $ sudo 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 3 – 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/ $ sudo composer create-project nette/sandbox myapp 
After successfully downloading all packages, setup proper permissions on application.
$ chown -R www-data.www-data myapp $ chmod -R 755 myapp $ chmod -R 777 myapp/tmp myapp/log 

Step 4 – Access Nette Application

At this stage you have successfully configured Nette framework on your system.
 http://localhost/myapp/www/ 
Install Nette PHP Framework

Step 5 – Create Apache VirtualHost

Now If you need to configure Nette with subdomain. Create a VirtualHost in your Apache configuration file. Create Apache configuration file under /etc/apache2/sites-available/
$ vim /etc/apache2/sites-available/nette.example.com.conf 
directory and add below content.
 <VirtualHost *:80>          ServerName nette.example.com         DocumentRoot /var/www/myapp/wwww          <Directory />                 Options FollowSymLinks                 AllowOverride None         </Directory>         <Directory /var/www/myapp>                 AllowOverride All         </Directory>          ErrorLog ${APACHE_LOG_DIR}/error.log         LogLevel warn         CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>  
Finally enable website and reload Apache service using below command.
$ a2ensite nette.example.com $ sudo service apache2 reload 

Thanks for Visit Here

Comments