There have been rave reviews about Laravel and how its supposedly cooler than CodeIgniter etc. I’m new to the PHP world – and I got severely stuck while getting to the ‘You have arrived Laravel homepage’. I spent a couple of days figuring out a ‘sane’ process – and here are the overall steps:
Environment: CentOS 6.5 running on VirtualBox 4.3 (running on Mac OS X Yosemite). [I didn’t want to spend too much time fighting OS X and setting up MAMP etc.).
Firstly, stop and remove Apache HTTPD if present: [ You might need to be root in order to execute this command]
$ service httpd stop
$ yum remove httpd
$ yum install httpd
For Laravel 4.2, PHP > 5.4 is required. So, remove any older PHP installations by using:
$ yum remove php-*
[This removes php and its dependencies]
Install PHP 5.6 and Laravel’s hard dependency PHP-MCrypt, PHP-MySQL (if using MySQL):
$ rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm $ yum install php56w php56w-opcache php56w-mcrypt php56w-mysql
Check PHP version by using : php -v (It should now report version > = 5.6).
Next, download the Laravel master repo, from : https://github.com/laravel/laravel/archive/master.zip, Unzip and copy extracted folder to /var/www/<appName> folder.
Add VirtualHost entry to Apache http config file at : /etc/http.d/conf/httpd.conf
<VirtualHost *:80> DocumentRoot /var/www/<appName>/public <Directory /var/www/<appName>/public > AllowOverride all </Directory> </VirtualHost>
Find out the Owner and Group of your Apache installation by using:
# egrep -i '^user|^group' /etc/httpd/conf/httpd.conf User apache Group apache
Change the permission of app/storage folder and allow the above user to write to it (This avoids the cryptic Exception in error handler and blank page issue after installing Laravel and trying to access http://localhost)
chown -R apache:apache app/storage
You might also need to do:
echo "0" > /selinux/enforce
Now, run the following in the folder /var/www/<appName> folder:
If PHP version is correct and everything else goes well, the folder should now contain a ‘vendor’ folder that contains all the required dependencies as described in the file composer.json.
Now, restart HTTPD server:
service httpd restart
Point your browser to localhost:80/ and this should bring up the ‘You have arrived ‘ page indicating that Laravel framework is setup properly.
Feel free to ask if you have any issues – I’ll try and help.