Setting up laravel 4 on Webfaction
Create your domain or subdomain. E.g laraveltest.hostname.com
Check here on how to create add domains or subdomains on webfaction.
Create your application. Make sure you select Static/CGI/PHP and PHP 5.4 runtime
Check here on how to create add applications on webfaction
Create your website and add domain and application you've created. E.g laraveltest
Check webfaction on how to create website on webfaction
Test in browser
http://laraveltest.hostname.com
and see you have Hello World displayed.
Setting up laravel 4
Installing composer
To install composer to your home directory
$cd ~
Run this using php54 runtime
$php54 -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
This will install composer to your home directory so you can run it like composer.phar
Installing latest laravel-4 version
As of this writing laravel 4 is still in better. To get the lastes go to http://four.laravel.com and get the latest version.
I got my version from https://github.com/laravel/laravel/archive/develop.zip
$ cd ~
$ wget https://github.com/laravel/laravel/archive/develop.zip
$ unzip develop
This will unzip the content of develop to laravel-develop directory in the home directory
Ready to install laravel dependencies
$ cd ~
$ cd laravel-develop
$ php54 ~/composer.phar install
This will install all laravel dependencies into the vendor directory in the laravel-develop directory
Create a directory in your home folder that will take all laravel apps
$ cd ~
$ mkdir laravelapps
$ cd laravelapps
$ mkdir laraveltest
Now copy the content of ~/laravel-develop/public directory into ~/webapps/laraveltest.
You should have these files inside the directory ~/webapps/laraveltest
index.php
.htaccess
favicon.ico
Now copy all files and folders inside ~/laravel-develop except vendor and public to ~/laravelapps/laraveltest/
We are almost there!
Editing index.php to point to the the right files
$ cd ~/webapps/laraveltest
$ nano index.php
Change this line
require __DIR__.'/../vendor/autoload.php';
To point to the new path:
require '/home/<<your-webfactio-username>>/laravel-develop/vendor/autoload.php';
Or
require '~/laravel-develop/vendor/autoload.php';
Then change this line
require_once __DIR__.'/../start.php';
To
require_once '/home/<<your-webfactio-username>>/laravelapps/laraveltest/start.php';
Update:
In order to use artisan commands do the same changes you made above to index.php in this file: ~/laravelapps/laraveltest/artisan
Done!!
Now check
http://laraveltest.hostname.com
You should see Hello World from laravel default '/' route.
Happy coding!!
Cheers!! @badu_bizzle
Special thanks to Taylor Otwell for creating the awesome PHP framework
Awesome! Thanks for sharing.
ReplyDeleteJust a comment, under the Installing latest laravel-4 version section, the link to http://four.laravel.com is actually broken and pointing to http://four.laravel.co.
Just updated the link to point http://four.laravel.com.
DeleteThanks for the correction.
Interesting Badu.. surprised I haven't come across Laravel.. Was considering Frapi (getfrapi.com). Nice to have an alternative. Good work man
ReplyDeleteThanks Pk.
DeleteLove it! I like this topic.This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting this again. Thanks a million and please keep up the effective work Thank yo so much for sharing this kind of info- laravel application development
ReplyDelete