php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11482 exec/system return value 11 for all C program
Submitted: 2001-06-14 04:57 UTC Modified: 2001-06-15 08:32 UTC
From: nicolay at ined dot fr Assigned:
Status: Closed Package: Program Execution
PHP Version: 4.0.5 OS: Linux, redhat 7.0
Private report: No CVE-ID: None
 [2001-06-14 04:57 UTC] nicolay at ined dot fr
if i use system("/bin/ls -al",$res), all is fin, $res=0.

BUT, if i use system("/home/xan/all_env",$res),
     the result is always 11 (for what ever C program i've write).

ls -al /home/xan/all_env
rwxr-xr-x [...] all_env
(compile dynamically or statically)

can you help me ?

I use apache 1.3.19 and php4.0.5 (and test before with php3.0.18)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-14 13:09 UTC] sniper@php.net
And what does this 'all_env' program do? 
Are the sources somewhere to get so we could try it?

Or could you please use some other program as example 
which is found on every system. This sounds
like your program is buggy, not PHP, as system() works 
for me just fine.

--Jani

 [2001-06-15 03:43 UTC] nicolay at ined dot fr
here is a simple example of all_env.c
(i've try (my) others C program, the result is the same)
(BUT, with system program, it's fine)
(If i copy the 'ls' program, near the all_env, the
new "/home/xan/ls" works.)
So what is wrong ? 

#include <stdio.h>

int main(int argc, char**argv, char**env)
{
   char *str;
   int k=0;
   FILE *fd;

   
   fd=fopen("environ", "w");
   str=env[k];
   while ( str != NULL )
   {
      printf("Env (%d): %s\n",k, str);
      fprintf(fd,"Env (%d): %s\n",k, str);
      str=env[++k];
   }
   fclose(fd);
   exit(0);
}
 [2001-06-15 08:31 UTC] nicolay at ined dot fr
the
fd=fopen("environ", "w");
function doesn't have the rights (nobody user) to create
file.
So, the C prg, return 11.
 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Dec 08 22:01:30 2023 UTC