Resolving Issues with Laravel Remote SSH Keys

I was recently banging my head over getting SSH keys to work with Laravel’s Remote Component. I’m apparently not alone in having problems getting this to work. I set up my remote connection as expected, pointing to my SSH private key file:

'production' => array( 
    'host' => 'xxx', 
    'username' => getenv('SSH_USER'), 
    'password' => '', 
    'key' => '/Users/gtaylor/.ssh/id_rsa', 
    'keyphrase' => '', 'root' => '/var/www', 
    ),

Giving PHPStorm a Chance

I’ve been a committed Sublime Text user for a while. I’ve spent a lot of time looking for the right mix of packages, learning the keyboard commands, auditioning LOTS of different themes and color schemes, and constantly playing with the user config (i.e., “trim_trailing_white_space_on_save”: true). Since I’m still fairly new to the PHP world and OOP specifically, I really didn’t want my editor doing any of the work for me either – code completion, auto-importing namespaces, handling Vagrant and Git commands in-app being some examples. As a result, I’ve resisted using a true IDE up to now.

Every time I’ve installed PHPStorm in the past to play around with it, I always disliked it’s lack of customizability in terms of the UI (which is surprising given it’s ridiculously complex Preferences/Settings). In spite of all of this, I keep giving PHPStorm a go every couple of months just to see what’s changed and I think I’ve had a breakthrough with the latest attempt.

“Fixing” the UI

The first challenge for me is to make it not ugly. I usually don’t even make it past this step before giving up and going back to Sublime, but this time I was able to get it just about right (for me).

 Steps:

  • Switch to Darcula theme.
  • Install the “total-conversion” of the UI by Shawn McCool.
  • Install the ColorIDE plugin.
  • Install the Dayle Rees color schemes for Jetbrains (I used one of his themes as a base to create my own color scheme). - Remove some of the annoying UI elements like the horizontal line above classes and between functions (“method separator color”). Hint:** you can’t remove it, but you can make it the same color as your background so it’s not visible. - Tone down the color of files that have been modified (VCS).
  • Remove the browser icons that show up in the upper-right.
  • Replace the ugly app icon with this...

Making it work like Sublime Text 

This is all about matching up the keyboard shortcuts with Sublime’s. Basically, all of the stuff you might be used to doing with Sublime via the keyboard is there (find anything, project switching, etc.). It’s just a matter of tracking them down. So now I’m going to give PHPStorm a workout for a few days exclusively. I’m really not that interested in it’s Git and Vagrant integration. I’d prefer to keep that in the Terminal for now, but I can already see some benefits with auto-importing and code completion that actually works. For Laravel, the lack of Blade highlighting is a problem (I’ve tried installing Textmate bundles for this unsuccessfully), but it’s apparently in the works.

Adding the Oracle extension (oci8) to MAMP PRO 3/OS X 10.9

I’ve never been successful in getting the OCI8 extension working on OS X (with or without MAMP) until now. I’ve been forced to use Vagrant (which is a usually a good thing) for anything requiring an Oracle connection).

 

Steps:

Make sure that the PHP version you are using in MAMP is in your path:
export MAMP_PATH=/Applications/MAMP/bin/php/php5.4.26/bin
export PATH=$MAMP_PATH:$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:~/composer-packages/vendor/bin

Download the basic and SDK packages.

Extract the files into a common folder (i.e.,/opt/oracle/instantclient). unzip *\.zip. They will all end up in a instantclient_11_2 folder, which I renamed to just instantclient. create two symbolic links:

ln -s libclntsh.dylib.11.1 libclntsh.dylib ln -s libocci.dylib.11.1 libocci.dylib

Download the source for the version of php that you are using in MAMP (I’m using 5.4.26).

Extract the PHP source file and move the created folder to the following location (based on PHP version): /Applications/MAMP/bin/php/php5.4.26/include/php. The contents of the extracted folder should be in the root of ../include/php.

Run sudo pecl install oci8 from anywhere.

For the oracle instant client path, use: instantclient,/opt/oracle/instantclient. If all goes well, the last line of the build process should say: You should add "extension=oci8.so" to php.ini In MAMP, go to File | Edit Template, choose your PHP version and add the above text where appropriate.

Open /Applications/MAMP/Library/bin/envvars and add the path to the instant client library: DYLD_LIBRARY_PATH="/opt/oracle/instantclient:/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"

Restart MAMP and go to the MAMP welcome page and open up phpinfo and see if there is an entry for OCI8. Done. Credit to http://caseymorford.com/2014/04/17/installing-oci8-with-mamp-pro/ for filling in a few missing pieces for me (downloading the source for the PHP version used in MAMP and edting the envvars file). For the other steps, the main difference for me is the preference of keeping the oracle library files in /opt/oracle like I would on an Ubuntu server.

Heroku/PHP Quick Tip #1 – Webroot

So I checked out Heroku yesterday after the official support for PHP announcement. I pushed up a basic install of Laravel 4.1 to a new free account. However, if you just create your repo, set up Laravel, and do a git push origin master , your webroot will be the project root, not /public. After reading about “buildpacks”, etc., I found out that all you need to do is create an empty file in the project root named “Procfile” and add:web: vendor/bin/heroku-php-apache2 public to it (assuming you are using Apache). I saw something else showing custom composer.json settings for heroku that defined the webroot, but I couldn’t get that to work.

Heroku/PHP Quick Tip #2 – Adding PHP extensions

If you are used to using Composer, adding PHP extensions to a Heroku PHP app is really easy. For adding the GD library, just add the extension as follows to the “require” section of your project’s composer.json file:

"require": 
{ 
​   "ext-gd": "*", 
    "laravel/framework": "4.1.28", 
    "doctrine/dbal": "2.4.2", 
    "guzzlehttp/guzzle": "4.0.2", 
    "way/generators": "2.6", 
    "fzaninotto/faker": "v1.3.0" 
},

Heroku has a complete list of already included extensions and those available to be added during deployment.