MacOS – Does Apache require special settings to run a command

apachemacosperlterminalwebserver

I am trying to create an image using Bio::Perl/Bio::Graphics and implement it on my webserver. However, whenever I am trying to run my scripts online, the command line does not respond to run my script.

One of my perl module files contains this system command:

my $command = "perl Graphics.pl $start $end $attributes";
system($command);

All values are routed to this command and all scripts work perfectly fine when run manually through the command line. Apache does not report an error messages except that the file it was supposed to create in Graphics.pl hasn't been created:

> [Mon Dec 16 12:15:59 2013] [error] [client ::1] Cannot Open Output 59_15_12_16_11_113_1_349_0.png, referer: http://localhost/~User/cgi-bin/Home.pl

>[Mon Dec 16 12:15:59 2013] [error] [client ::1] File does not exist: /Users/User/Sites/cgi-bin/59_15_12_16_11_113_1_349_0.png, referer: http://localhost/~User/cgi-bin/Results.pl?start=1000&end=20000&chr=All&type=protein

Is there an additional setting that needs to be configured in the Apache settings so it can use the command line?

My specs are the following:

  • Server version: Apache/2.2.24 (Unix)
  • perl 5, version 16, subversion 2 (v5.16.2)
  • Mac OS 10.9 Mavericks

Any help would be greatly appreciated.

Best Answer

The problem has been solved. Basically Apache did not have permission to write into the folder. Steps to solve the issue included:

  1. ls -la cgi-bin to check the permissions of my cgi-bin folder.
  2. Give the _www group ownership of cgi-bin and give the group write permissions: chgrp -R _www cgi-bin && chmod g+w cgi-bin.
  3. In addition, I added my User to the group _www so I would not have to authenticate myself every time I added a file in the cgi-bin folder.
  4. sudo dseditgroup -o edit -a ikr -t user _www was used to do Step 3 (ikr has to be replaced with the username to be added)