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
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?

Link to comment
Share on other sites

Will Apache have different permissions for accessing files on the disk, than I have when I am running a command via the Terminal?

 

Yes. You can find the user & group Apache runs under within Apache's main configuration file httpd.conf.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.