Question

My Nutch directory lies in /home/myserv/nutch/nutch-1.0/

My php applictaion is in the diretcory /home/myserv/www/

Theres a a php file in my /home/myserv/www/ diretcory that runs a exec command to run a nutch command.PHP code is like :

$output = exec("bin/nutch all");

When I run the command from the command line I need to be in the "/home/myserv/nutch/nutch-1.0/" directory

When i'm trying to run it through the php exec() ,I just can seems to make it execute.

I have tried giving the ful path like (below) but nothing works :(

$output = exec("/home/myserv/nutch/nutch-1.0/bin/nutch all");

Desperately looking for help

Was it helpful?

Solution

Directories under /home/ are usually well protected against others, check the permissions to make sure that the absolute path reference can indeed navigate all the way to nutch.

OTHER TIPS

There are several problems here.

  1. When executing from a script, it's hard to predict what the current working directory will be, so it's best to use the full path.

  2. Remember that the PHP script is being run by the user that Apache runs under, not by you. So make sure that the Apache user (which may have a different name depending on the distro and the Apache version) has permission to run the Nutch script, and to read/write all the Nutch data files.

  3. 'all' isn't a valid option for the nutch command, so I'm not sure what it is you're trying to do.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top