Unable to create file using PHP

Hi all

I have written a PHP program which will run a C program using ‘system’ command. As per my intention, my C program will create a file which the PHP will read(to get the output of C as the output is a string).

If i run my C program alone in terminal, it is creating a file with the desired content in it. But when i use PHP to run the C program, it is not creating the file. When i checked by removing the file part in the C program, the PHP is running the C program correctly (checked using printf). But when i add file part to the C program, nothing is working…C pgm is not printing anything.

My main returns a value 0. But in the PHP system command, it prints return value as 139.
What may the reason for this? Please suggest me few ways to overcome this.

Hello harsha2624,

try to post some of your code here.

Jake