Knowledge Base: Tutorials

Knowledge Base

Q: Installing Laravel PHP framework in cPanel shared hosting

You can install Laravel framework in any shared hosting account with shell access, we will remove the default public_html folder so it will be better to have fresh hosting account dedicated for your Laravel application.

Requirements

You need to enable PHP 5.6 or above in your account, you can do that from your cPanel > PHP selectors

Installation steps

  • Access your account via shell
  • create a folder in your PATH to install Composer (package manager):

    mkdir bin
    
    
  • Install composer:

    curl -sS https://getcomposer.org/installer | php -- --install-dir=bin
    
    
  • create shortcut for composer:

    echo 'exec php ~/bin/composer.phar $@' > bin/composer
    chmod 755 bin/composer
    
    
  • Install Laravel, we will install it in folder project, You can change if required:

    composer create-project laravel/laravel project
    
    
  • Replace default public_html with public folder of Laravel

    rm -fr public_html
    ln -s project/public public_html
    
    
  • And finally, some permission fixes

    chmod 755 project
    chmod 755 project/public
    chmod 644 project/public/index.php
    
    
  • You are done, you can see the welcome message of Laravel when you access your website
Last update on: 2017-03-05 07:50:00