My php page had a line like,
shell_exec('wget <a href="http://www.example.com/path/to/something'">http://www.example.com/path/to/something'</a>);
The actual parameters of wget command were more complicated. There were two things I had to resolve. wget command does not come with OS X by default, so you needed to install it first. One of easy ways to install wget is through homebrew, which I already had. I simply ran,
$ brew install wget
Ron explained how to install homebrew.
But then I figured that apache running the php page could not find wget command, which is located in /usr/local/bin/wget. I use MAMP and I had to tell MAMP where to look for wget. I opened up text file, /Applications/MAMP/Library/bin/envvars and added the following line in it,
Stop and start Apache Server of MAMP and the problem was solved.