How to Install Laravel 4 on a Hostgator Shared Hosting Account

You can easily get Laravel 4 running on a shared hosting account by just uploading all the files to the server. But just make sure to map the domain (or sub-domain) root the the ‘public/’ directory of Laravel.

If you have an old Hostgator account, you may see the following error when you try to launch the site.

Warning: require(__DIR__/../bootstrap/autoload.php) [function.require]: failed to open stream: No such file or directory in /home1/[YOUR_USERNAME]/public_html/[YOUR_PROJECT_DIR]/public/index.php on line 21

Warning: require(__DIR__/../bootstrap/autoload.php) [function.require]: failed to open stream: No such file or directory in /home1/[YOUR_USERNAME]/public_html/[YOUR_PROJECT_DIR]/public/index.php on line 21

Fatal error: require() [function.require]: Failed opening required '__DIR__/../bootstrap/autoload.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home1/[YOUR_USERNAME]/public_html/[YOUR_PROJECT_DIR]/public/index.php on line 21

A common reason for this is a PHP version mismatch. If your Hostgator account is created before 16 May, 2013, you’re likely to have an old PHP version installed. Hostgator has the latest PHP on server, but it needs to be activated through your /public/.htaccess file.

To do that, open your /public/.htaccess file and add the following two lines on the top of the file.

Hopefully this should get things working. If not, try to leave a comment below.

jQuery Table Plug-in Review – jqGrid

After going through a lot of options to select the best jQuery table/grid plug-in, I’ve finally chosen jqGrid.

It has a lot of flexibility and built-in options for most of the common requirements, such as.

  • Sorting
  • Pagination
  • Search (on both client and server)
  • Filters
  • In-line editing
  • Live syncing with server
  • Categories within tables (grouping into sub-tables)
  • and much more…

You can view a live demo of the jQuery table plug-in here. It’s free, open-source and actively maintained. It uses jQuery UI, so you can change the theme easily to match with the rest of your application.

Here is the project home page where you can get downloads, documentation and updates.

 

MAMP MySQL Won’t Start? – How to Fix the MySQL Server Issue in MAMP

If you get the message “Error: Could not connect to MySQL server!” or if you have trouble starting up or restarting the MAMP Server with MySQL, you can try the following solution.

  1. Quit MAMP
  2. Open Terminal window
  3. Type “killall -9 mysqld” and press enter
  4. Start MAMP
  5. Start servers

This fixed the issue I was having with the MySQL server starting up on MAMP.

http://www.shaneperera.com/blog/

Installing CodeIgniter 2 with Doctrine 2.0

I was struggling for few hours on installing Doctrine 2 with the new version of CodeIgniter. Then I found this excellent tutorial by Joseph on how to install and configure Doctrine 2 with CodeIgniter 2.

If you’re still struggling, here you can download a pre-configured installation with CI2 & D2.
(Please note that there may be new versions out there by now – This will only help you to get the file structure and configuration right.)

WAMP Server – How To Setup Multiple Root Folders

If you have a WAMP Server installation, maybe you’re run into the need of creating multiple roots for different sites.

Here’s how to do it.

1. Open the httpd.conf file. (WAMP Icon > Apache > httpd.conf)

2. Find the line which says ‘Listen 80′

3. Change it to the following

You have to change the DocumentRoot and directory paths (within the www folder)

4. Save the file and restart the server. (WAMP > Apache > Service > Restart Service)

This will now create 3 differant root directories in your localhost.
They are accessible via,

http://localhost:80/

http://localhost:81/

http://localhost:82/

This can be taken another step further by assigning the IP addresses in your host file. See here for more info.

So you can end up with something like,

http://localhost/

http://mysite/

http://phpsite/