Hey! I don't know how you stumbled into this domain.
But, while your here you should checkout my work and ramblings.

-Thanks.

Latest Ramble

Starting Apache from Apatana IDE

Posted by admin on May 21, 2013

I think it's great that the folks at Aptana thought to incluce a webserver with the IDE. But, I prefer to use my Apache 2 install. It's easy to add and configure another server from within the IDE. Except that, starting or stopping Apache on port 80 requires root or sudo. When I typed my usual start command into Aptana's setup dialog, I realized there was no prompt to enter the password.

After some digging I found that I 'should' be able to send the password like so:

echo 'password' | sudo -S apachectl start

This line echo's the password to the sudo start command. The -S argument is supposed to take the echo'ed password from STDIN and pipe it to the sudo command. This works when entered into the console, but failed from Aptana. So, after a little more research I was able to hack an equivalent command:

'password' | sudo apachectl start

My assumption is that Aptana sends the command as it's written. So, sending the command echo 'password' is equivilant to typing 'echo password' when I would normally be prompted for the password. My password isn't prefixed with 'echo' so this would fail. The second part of the assumption is that the -S flag does nothing in this instance, becuase we are not running the command from a shell script. So, I just left it out.

To add your web server to the Aptana IDE:

Open the Aptana Preferences, and under Aptana Studio > Web Servers, click the 'Add New' button.

Config

And then simply fill out the necessary fields, make sure to replace the word 'password' with your actual sudo password.

Config

I then selected this as my default server.

Presto! Now Aptana will start Apache Server from the 'Run' command in the IDE.


Flickr