-3

I'm trying to install some software (called Prohits, used for mass spectrometry data management) on a localhost server I set up. One of the requirements for the install is that I have wget installed. So I installed Homebrew and got wget and verified that it was installed by typing it in the terminal.

However, the server is giving me an error that wget is not installed. I had to use an older version of PHP for the installation so I'm wondering if that might be causing this. Does wget have to be linked somehow to the php.ini file of the older PHP version in order for the server to recognize that it is installed? I had to do something similar for it to recognize that PEAR was installed which is why I'm wondering. Or does it needed to be included in httpd.conf?

covfefe
  • 113
  • 1
  • 4
  • A quick work-around is always to simply edit the script and use the absolute path rather than just `wget` – HBruijn Dec 28 '15 at 08:25

2 Answers2

1

Check that wget is in the PATH for whichever user is running the app.

user9517
  • 114,104
  • 20
  • 206
  • 289
  • I found that it was in this path `/usr/local/Cellar/wget/1.16.3/bin/wget`, added it to .bash_profile and checked that it appeared when I put 'echo $PATH' in terminal. But when it is run by php exec on the server, I get an error stating 'sh: wget: command not found'. The user for both are the same (me). – covfefe Dec 25 '15 at 23:01
0

The server is giving an error because Apache's $PATH variable does not contain /usr/local/bin, which is the directory that wget is located in. Although the system's $PATH variable contains it (so using wget works in the console), Apache's $PATH variable is separate from that.

I resolved this by adding the necessary path to the $PATH variable in Apache's plist file, which is in /System/Library/LaunchDaemons/org.apache.httpd.plist in OS X. If the $PATH variable is already defined, add the path to it. If not, define it. So I added the following inside the <dict> tags:

<key>PATH</key>
<string>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin</string>

I restarted my server and wget was recognized. You can also check that the new path is reflected in your PHP file with echo $PATH;.

covfefe
  • 113
  • 1
  • 4