How to install Laravel on FreeBSD 9.2

Laravel Shirt - Basic Dark As I have more machine that run FreeBSD 9 I decide to explore the installation process of PHP Framework. I want to start with Laravel as I feel this framework will be suitable with our team requirement. I already have working PHP 5.2.17 with Apache on my FreeBSD 9.2 box so I have to upgrade it to another version. Lets get started :

Checking installed PHP, MySQL and  Apache

Check PHP

# pkg_info | grep php
php52-5.2.17_15     PHP Scripting Language
php52-ctype-5.2.17_15 The ctype shared extension for php
php52-curl-5.2.17_15 The curl shared extension for php
php52-dom-5.2.17_15 The dom shared extension for php
php52-extensions-1.3_1 A “meta-port” to install PHP extensions
php52-filter-5.2.17_15 The filter shared extension for php
php52-gd-5.2.17_15  The gd shared extension for php
php52-hash-5.2.17_15 The hash shared extension for php
php52-iconv-5.2.17_15 The iconv shared extension for php
php52-json-5.2.17_15 The json shared extension for php
php52-pcre-5.2.17_15 The pcre shared extension for php
php52-pdo-5.2.17_15 The pdo shared extension for php
php52-pdo_mysql-5.2.17_15 The pdo_mysql shared extension for php
php52-pdo_sqlite-5.2.17_15 The pdo_sqlite shared extension for php
php52-posix-5.2.17_15 The posix shared extension for php
php52-session-5.2.17_15 The session shared extension for php
php52-simplexml-5.2.17_15 The simplexml shared extension for php
php52-spl-5.2.17_15 The spl shared extension for php
php52-sqlite-5.2.17_15 The sqlite shared extension for php
php52-tokenizer-5.2.17_15 The tokenizer shared extension for php
php52-xml-5.2.17_15 The xml shared extension for php
php52-xmlreader-5.2.17_15 The xmlreader shared extension for php
php52-xmlwriter-5.2.17_15 The xmlwriter shared extension for php

Check MySQL

# pkg_info | grep mysql
mysql51-client-5.1.72 Multithreaded SQL database (client)
mysql51-server-5.1.72 Multithreaded SQL database (server)
php52-pdo_mysql-5.2.17_15 The pdo_mysql shared extension for php

Check Apache

# pkg_info | grep apache
apache22-2.2.26     Version 2.2.x of Apache web server with prefork MPM.

Upgrade PHP and the Extensions

According to Laravel documentation, PHP version needed for Laravel 4 is PHP >=5.3.7

# cd /usr/ports/lang/ && ls | grep php
hiphop-php
php-mode.el
php5
php5-extensions
php52
php52-extensions
php53
php53-extensions
php55
php55-extensions
php_doc

More in PHP5 port

# cat php5/Makefile | more

# Created by: Alex Dupre <[email protected]>
# $FreeBSD: lang/php5/Makefile 330741 2013-10-18 12:37:45Z ale $

PORTNAME=       php5
PORTVERSION=    5.4.21
PORTREVISION?=  0
CATEGORIES?=    lang devel www
MASTER_SITES=   ${MASTER_SITE_PHP}
MASTER_SITE_SUBDIR=     distributions
DISTNAME=       php-${PORTVERSION}

Ok, I’ll choose PHP5 port only as this version will give me PHP 5.4.21 which is supported by Laravel and also supported by specific package such as Laravel 4 Generator by Jeffery Way.

Delete older PHP 5.2

# pkg_delete -vx php52

Install PHP 5.4

# cd /usr/ports/lang/php5 && make install

php54_freebsd92

Choose options; CLI, Apache module and LINKTHR.

Check PHP version after install

# php -v
PHP 5.4.21 (cli) (built: Dec 17 2013 13:07:34)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

ok, continue with PHP extensions

# cd /usr/ports/lang/php5-extensions && make install

Choose same as old process (PHP 5.2 install) + Mcrypt.

php54_freebsd92_mcrypt

Restart Apache

# service apache22 restart
Performing sanity check on apache22 configuration:
Syntax OK
Stopping apache22.
Waiting for PIDS: 789.
Performing sanity check on apache22 configuration:
Syntax OK
Starting apache22.

php5421_freebsd92

At this stage we have working Apache, MySQL and PHP on FreeBSD 9.2

Install Composer & Laravel

Download Composer

I use snapshot version of Composer

# wget -c http://getcomposer.org/composer.phar

# ln -s /home/alam/composer.phar /usr/local/bin/composer

# chmod 755 composer.phar

Download Laravel

# wget -c --no-check-certificate https://github.com/laravel/laravel/archive/master.zip

Unzip Laravel

# unzip master.zip

Move Laravel to documentroot

# mv /home/alam/laravel-master /usr/local/www/apache22/data/laravel

Open composer.json

# cd /usr/local/www/apache22/data/laravel/ && ee composer.json

Add Jeffery Way Generator

“name”: “laravel/laravel”,
“description”: “The Laravel Framework.”,
“keywords”: [“framework”, “laravel”],
“license”: “MIT”,
“require”: {
“laravel/framework”: “4.1.*”,
“way/generators”: “dev-master”
},

save.

Install Laravel through Composer

# cd /usr/local/www/apache22/data/laravel/

# composer install

All files will be download and when ready you can access it like previous how to.

Picture from : Laravel Shirt – Basic Dark by titeyado

Tags: