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',
But received the following error message:
Unable to connect to remote server.
I tried a number of potential fixes (file permissions, pointing to the public key instead (more on that below), etc.), but I could not authenticate using the SSH key.
Though Vagrant (at least with VirtualBox) appears to be semi-broken at the moment under Mavericks, I’ve updated my simple vagrant config for developing with Laravel as requirements keep growing for different projects: Github
By the way, the temporary fix for the vagrant under Mavericks seems to be running the following:
sudo /Library/StartupItems/VirtualBox/VirtualBox restart
I just picked up a refurbished 2012 Macbook Air from the Apple online store to replace a 2007 Macbook Pro. I didn’t use the MBP much because it just couldn’t keep up, but I missed being able to work anywhere, including at home without having to sneak upstairs to the office.
Now that I have the MBA, those limitations are gone, but working on the same project on different computers can still be a challenge. However, compared to just a few years ago, creating the same web development environment across several computers can be accomplished with just a little effort.
In my last post, I professed my
love like for using MAMP over the built-in/download/make/make test/make install/scratch eyes out method of setting up a web dev environment on OS X. I felt so good about it, I decided to get “work” to purchase MAMP PRO to take it to another level. Frankly, I’m not so sure it’s worth it, but running MAMP on port 80 without having to enter my password every time is nice.
In order to upgrade, I kept my vhosts file for my current MAMP install for safekeeping and then uninstalled MAMP since it was an older version. Then I installed the new version, set up my first vhost (a PHP Laravel project) and everything worked. MAMP PRO likes to set up virtualhosts using Server Names instead of Ports, though ports are an option. It even edits your hosts file for you so the names resolve properly. Nice.
Next it was time to hook up MAMP PRO to Coldfusion 10. This was a pain in the ass, but I’ll just go thru the final steps in case anyone is in the same boat. I ended up doing a fresh install of CF10 after having no luck with just running wsconfig on the existing install.
Here’s the deal:
MAMP PRO uses it’s own dynamically created httpd.conf file based on the settings you provide in the GUI. And it also provides “templates” that are used as the base for httpd.conf, as well as the PHP and MySQL config files. To connect CF10 to MAMP PRO using the web server connector utility during the CF10 install, first point the httpd.conf file that MAMP PRO is currently using (dynamically created from it’s template).
This httpd.conf file is located at /Users/[username]/Library/Application Support/appsolute/MAMP PRO/httpd.conf
After pointing to that file, click on Advanced and point to /Applications/MAMP/bin/apache2/bin/apachectl and /Applications/MAMP/bin/apache2/bin/httpd where required.
This is all pretty much standard stuff when connecting Apache and CF10 except for the location of httpd.conf
The trick is that once the CF10 web server connector (wsconfig) is done and has made changes to httpd.conf, you need to open the file, go to the bottom and copy the line that looks like this:
Include “/Users/[username]/Library/Application Support/appsolute/MAMP PRO/mod_jk.conf”
Now go into MAMP PRO and click on File | Edit Template | Apache | httpd.conf
Paste the line above to the bottom of that file. And then go find this line:
DirectoryIndex index.html index.php
and change it to
DirectoryIndex index.cfm index.html index.php
Now whenever MAMP PRO restarts and recreates the httpd.conf file, the CF10 stuff will be there since it’s now part of the base template.
The only problem I had left to deal with is that MAMP PRO started telling me that the built-in Apache was running and creating a port conflict. I kept killing the httpd process that showed up in the Activity Monitor, but it kept coming back. I finally noticed that MAMP PRO has a Tools menu with an for stopping the built-in Apache. Somehow, it was able to do what I couldn’t.
So I just got my 5-year old Macbook Pro back from Apple* after it sat dead for several months (my kid killed it playing Minecraft). I decided I needed it for do some web work in the family room while pretending to watch the Real Lives of Whatever with the family.
I have the impression that real, tough guy developers don’t sissy their way into a local dev environment using MAMP. You gotta use the built-in version of Apache, and download, make, make test, make install, etc. etc. everything else. So that’s what I did.
The Apache part is easy because it’s already there. So is PHP (5.3.15 for Mountain Lion I think). However, it doesn’t include mcrypt, which is required for Laravel. To get that working, just follow the 20 or so steps here, which including getting the latest version of Xcode. Fun.
MySQL was fairly easy if you choose the package installer (sissy) over compiling it yourself (tough guy).
Once it’s finally working, you feel good about yourself, then realize that the mysql ports are different for the dev machines that are still using MAMP and share the same code, PHP CLI isn’t in your path, you don’t know how to switch between PHP 5.2/5.3 if you need to (easy with MAMP), etc.
So in the end, I just went back to using MAMP.
*Apple has a nice deal where they fill fix anything and everything for $310.