Jump to content

Exec() and System() Not Working?


Recommended Posts

When executed from the terminal, the following command works perfectly:

 

gnuplot '/Applications/IPG/htdocs/ftp/company_name/Charts/gnuPlotCommandFile.gp'

 

However, when I run it from inside PHP with:

 

exec("gnuplot '/Applications/IPG/htdocs/ftp/company_name/Charts/gnuPlotCommandFile.gp'");

 

...or:

 

system("gnuplot '/Applications/IPG/htdocs/ftp/company_name/Charts/gnuPlotCommandFile.gp'");

 

...nothing seems to happen. How can I correct this?

 

Note - exec is enabled on my system, according to the following function:

 

function exec_enabled() {

  $disabled = explode(', ', ini_get('disable_functions'));

  return !in_array('exec', $disabled);

}

 

Thanks very much in advance to all for any info.

 

Link to comment
https://forums.phpfreaks.com/topic/218251-exec-and-system-not-working/
Share on other sites

I am running Apache via MAMP, a local amp stack running on my development system on my iMac.  I am running MAMP and the Terminal in my own user account.  Will Apache have different permissions for accessing files on the disk, than I have when I am running a command via the Terminal?

Checking httpd.conf, I see:

 

<IfModule !mpm_winnt.c>
<IfModule !mpm_netware.c>
#
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.  
#
# User/Group: The name (or #number) of the user/group to run httpd as.
#  . On SCO (ODT 3) use "User nouser" and "Group nogroup".
#  . On HPUX you may not be able to use shared memory as nobody, and the
#    suggested workaround is to create a user www and use that user.
#  NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
#  when the value of (unsigned)Group is above 60000; 
#  don't use Group #-1 on these systems!
#
User myAdminUsername
Group #-1
</IfModule>
</IfModule>

 

Next to "User" it shows the same admin name I use when logging in.  I would think this would mean it would have full access to all files and folders.  What could I be missing?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.