depicus

changing the digital world one bit at a time...

Blants (noun) the rants of a blogger

Using Eclipse for php development on OSX

September 4, 2010 by The Man

I am starting to hate Visual Studio more and more as it gets slower and slower so it was about time I set up a new dev environment on my Mac so I didn’t need to start a VM to run the only app I now ever use on Windows.

Enter Eclipse which I use for Java development for a payment system on AS400 and a bit of Android stuff but never really for PHP

I downloaded the latest version with PHP support which is now 64bit and was ready to go. But not so fast. Having created a test site in the default location (/Users/Brian/Documents/workspace) I ran the site up in the local window. Bum 404 not found.

Ok this was easy to solve. Go to /etc/apache/httpd.conf and add an alias

Alias /myBMI /Users/Brian/Documents/workspace/myBMI

and a directory listing

 
Options All MultiViews 
AllowOverride None 
Order allow,deny 
Allow from all 

then save and restart Apache sudo /usr/sbin/apachectl restart

Great it finds the page but I now get a permission denied 403. This one took a little longer and it is a bit of a fudge. Now this is a development machine so I don’t really need to worry about security as it will never be on the web. While in httpd.conf look for User and you will see it is set to _www. Now OSX doesn’t make it easy to change permissions and what I really should have done is given _www permissions to my workspace folder but it was quicker to just change the user to me.

User Brian
Group _www

Save and restart Apache and we are go for PHP development. Thanks to Suburbia for the pointers.