Tuesday, 27 September 2016

Setup laravel project to run on xampp for linux

Overview

What is laravel?
Laravel is a free, open source PHP web application framework, designed for the development of model–view–controller (MVC) web applications. Laravel is released under the MIT license, with its source code hosted on GitHub.
What is xampp?
XAMPP is a free and open source cross-platform web server solution stack package, consisting mainly of the Apache HTTP Server, MySQL database, and interpreters for scripts written in the PHP and Perl programming languages.

Requirements

  • xampp
  • composer
  • mcrypt

Setup

  • First, Download xampp. Then, you need to setup xampp and change its security settings. Execute,
      chmod 755 xampp-linux-*-installer.run
    sudo ./xampp-linux-*-installer.run
    This will open the installer and just click “next” and it will install xampp files in /opt/lampp folder. You should first check if lampp is functioning properly. To test this,
      sudo /opt/lampp/lampp start
    Let it start everything for you. Now just go to http://localhost and see it is working. We will need to setup security settings as well.
      sudo /opt/lampp/lampp security
    Set all the passwords etc, and you are done!
  • Now you need to get composer
      curl -sS https://getcomposer.org/installer | php
    sudo mv composer.phar /usr/local/bin/composer
    If you still get an error, please refer to composer website.
  • Now you need to get important dependencies of laravel - mcrypt.
      sudo apt-get install php5-mcrypt php5-json
    And now run,
      sudo php5enmod mcrypt
    To make sure it is running,
      php -i | grep mcrypt
    It will output
      .......
    mcrypt support => enabled
    mcrypt_filter support => enabled
    .......
  • Let us create an app - cd into /opt/lampp/htdocs and mkdir laravel-projects. Then finally cd laravel-projects. Now execute below command to create a fresh project.
      sudo composer.phar create-project laravel/laravel --prefer-dist
    It’s gonna take its time. Just wait for it to finish. Once it is done, execute
      sudo chmod -R 775 app/storage
  • Now you can modify app/config/app.php to change locale, timezone, debug (to ‘true’ - for viewing errors) etc.

Testing

To test, Just go to http://localhost/larvel-project/laravel/public/ , you will see a page with “You have arrived.” as shown below.
Or you can simply run
    sudo php artisan serve
and visit http://localhost:8000 you will see a page with “You have arrived.” as shown below.
Intro page
That’s it. Now you can start developing awesome apps.
https://bhavyanshu.me/tutorials/setup-laravel-project-on-xampp-linux/01/12/2015

Creating new virtual host while using Xampp in Ubuntu (Linux)


I need this stuff quite often. Every time i need to create a new virtual host in Ubuntu i have to google/search to find this solution as i cannot remember these paths properly. I am posting it here for quick reference for myself. Bookmark it for yourself (which i am going to do after i have finished posting it ;))
1. Enable virtual hosts by editing httpd.conf, if it is not enabled already. Once you enable it you can skip this step next time.
sudo gedit /opt/lampp/etc/httpd.conf
Find #Include etc/extra/httpd-vhosts.conf and remove the # to un-comment this line
Include etc/extra/httpd-vhosts.conf
2. Add new virtual host by opening the httpd-vhosts.conf file
sudo gedit /opt/lampp/etc/extra/httpd-vhosts.conf
Usually, by default there are two virtual hosts in this file. You can edit one or create new one by copy-pasting one of them. The required entries are DocumentRoot andServerName
<VirtualHost *:80>
ServerAdmin your_email@domain_name.com
DocumentRoot /opt/lampp/htdocs/mysite_folder
ServerName mysite.local
ServerAlias www.mysite.local
ErrorLog logs/mysite.local-error_log
CustomLog logs/mysite.local-access_log common
</VirtualHost>
3. Next, you will need to tell Xampp server where to find the address you added above:
sudo gedit /etc/hosts
Add the following line:
127.0.0.1 mysite.local
4. Restart xampp server by doing
sudo /opt/lampp/lampp restart
5. Type http://local.mysite in browser’s address bar and it should work.

http://www.devarticles.in/linux/creating-new-virtual-host-while-using-xampp-in-ubuntu-linux/

DotNetNuke

Joomla