June 8, 2014 in Laravel
The other day I decided I was going to start to learn a PHP Framework. There are tons out there, but I decided I'd like to learn Laravel. By far, the hardest part of getting everything installed and configured, was getting composer installed on my Dreamhost shared server, so I thought I'd show my solution (to help you, and me when I need to do this again :P)
First off, you need to make sure that you have SSH access on your server, and a way to SSH into it (Terninal, or Putty). Once you log in, there are a few things you need to do to make sure that PHP is configured correctly. First we need to make sure that you are using PHP 5.4. Type in the following command/s to edit the settings
If that file does not exist, type these commands
cd ~/ touch .bash_profile vi .bash_profile
Alright, now that we're in the .bash_profile file, press i to enter insert mode and add this line.
Then type esc, followed by ':wq' to save and exit. Now that we have the correct version of PHP running, we can install phar. To do this we need to create a phprc file to hold the settings
mkdir -p ~/.php/5.4 cd ~/.php/5.4 touch phprc vi phprc
Once vi is open, press 'i' for insert mode, and type in the following six lines.
extension = phar.so detect_unicode = Off phar.readonly = Off phar.require_hash = Off suhosin.executor.include.whitelist = phar memory_limit = 128M
Once that is all typed in, hit esc, then type ':wq' to save and exit.
Now your server has the phar extension enabled. On to installing composer! To install composer, enter the following command.
curl -s https://getcomposer.org/installer | php
Congratulations! Now composer is correctly installed on your server!
If you are installing the Laravel Framework, make sure you are in the directory where you are doing the project, and run the following command
php composer.phar create-project laravel/laravel --prefer-dist
Thats it! You're now ready to go with Laravel.
Edit: One last thing you are going to need to do is make sure that the webserver is pointing to the right directory. The directory that people will hit is the public folder. So if you installed it as shown above, you will need to change the web directory to this.