Re: exec()
Piotr Wolski wrote:
[color=blue]
> Michael Austin wrote:
>[color=green]
>> Piotr Wolski wrote:
>>[color=darkred]
>>> Michael Austin wrote:
>>>
>>>> Piotr Wolski wrote:
>>>>
>>>>> Piotr Wolski wrote:
>>>>>
>>>>>> Michael Austin wrote:
>>>>>>
>>>>>>> Piotr Wolski wrote:
>>>>>>>
>>>>>>>> i'm trying to do so:
>>>>>>>> exec("progs");
>>>>>>>> or passthru("progs ");
>>>>>>>> even when i add all the path it doesn't take any result.
>>>>>>>> i tried exec("./progs 2> error_file");
>>>>>>>> when compiled programm is in the directory where the script is,
>>>>>>>> then the error_file looks like:
>>>>>>>> ./progs: syntax error at line 1: '(' unexpected
>>>>>>>> what the hell does it mean??
>>>>>>>> ./progs exectuted from command line does what he should do very
>>>>>>>> good..
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> does the webserver know where .progs lives? you would need to
>>>>>>> include the full filespec if it is not where the webserver thinks
>>>>>>> it is or add the path to the httpd.conf (apache - you'll have to
>>>>>>> figure it out for yourself on IIS). To find out where the
>>>>>>> webserver thinks it should be looking, use something like this:
>>>>>>>
>>>>>>> $out = exec("pwd");
>>>>>>> echo $out ."<br>\n";
>>>>>>> or
>>>>>>> $output = `pwd`;
>>>>>>> echo $output ."<br>\n";
>>>>>>>
>>>>>>> Now, does progs live in this directory? if not, how do you expect
>>>>>>> the server to find it???
>>>>>>>
>>>>>>
>>>>>> The programm lives exactly in the directory that your short script
>>>>>> shows on.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> why it returns so strange error?:
>>>>>
>>>>>
>>>>> ./progs: syntax error at line 1: '(' unexpected
>>>>>
>>>>> ?????progs is compiled program..who can explain that?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Here is a "wierd" example from the docs:
>>>>
>>>> <?php
>>>> exec('/bin/sh -c "/bin/tar -xzf /tmp/'.$filename.'
>>>> install/desc-file install/info-file install/deps-file"');
>>>> ?>
>>>>
>>>> so yours would look like:
>>>>
>>>> exec('/bin/sh -c "/full/file/dir/progs 2 >error_log"') ;
>>>
>>>
>>>
>>>
>>> I tried this and in error_log file is the same as before that there's
>>> syntax error at line 1: '(' unexpected..
>>>
>>>>
>>>> have you tried using back-tick "`" method?
>>>
>>>
>>>
>>> no i haven't..
>>> could you let me know what the code should look like?
>>>
>>>> is the webserver owner also the owner or in the same group as the
>>>> progs file?
>>>
>>>
>>>
>>> http://www.cs.purdue.edu/help/www/using-cgi.html <--here is
>>> everything about configuration of the server i'm using..
>>>
>>>>
>>>> what is line 1 of the progs program?
>>>>
>>>
>>> i don't know cause it's already compiled program..[/color]
>>
>>
>>
>> Well if this error is in the error_file then the output is from the
>> program itself, not the web server. You will need to find out who
>> wrote the code and broke it.
>>
>> can you execute the "c" program from a command prompt (log into the
>> box and execute it?) if not, there is not much else we can do for you
>> here...[/color]
>
>
> Yes sure, i can execute this program from command line,i can even write
> this programm here cause it's very simple program written just for tests:
>
> #include <stdlib.h>
>
> int main()
> {
> printf("test");
> return 0;
> }
>
> And that's all program..
> So what can you say about that? this problem is really strange..i hope
> you'll find some clue for that cause i'm working under it 24h/day and
> still nothing..
> thanks, peter[/color]
I don't do this often, but, if you would like, send me a private email with:
ls -la progs and the directories down to progs, uid/gid of the webserver owner,
should have at least group:read access for the webserver owner.
example:
d?????? uid/gid abc
d?????? uid/gid xxxx
d?????? uid/gid yyy
-rwe?????? uid/gid progs
if you do this, you will probably find your problem also try setting the file
to permissions 777 and all of the directories (temporarily as a test) to see if
there is any difference.
--
Michael Austin.
Consultant - Available.
Donations welcomed. Http://www.firstdbasource.com/donations.html
:)
Piotr Wolski wrote:
[color=blue]
> Michael Austin wrote:
>[color=green]
>> Piotr Wolski wrote:
>>[color=darkred]
>>> Michael Austin wrote:
>>>
>>>> Piotr Wolski wrote:
>>>>
>>>>> Piotr Wolski wrote:
>>>>>
>>>>>> Michael Austin wrote:
>>>>>>
>>>>>>> Piotr Wolski wrote:
>>>>>>>
>>>>>>>> i'm trying to do so:
>>>>>>>> exec("progs");
>>>>>>>> or passthru("progs ");
>>>>>>>> even when i add all the path it doesn't take any result.
>>>>>>>> i tried exec("./progs 2> error_file");
>>>>>>>> when compiled programm is in the directory where the script is,
>>>>>>>> then the error_file looks like:
>>>>>>>> ./progs: syntax error at line 1: '(' unexpected
>>>>>>>> what the hell does it mean??
>>>>>>>> ./progs exectuted from command line does what he should do very
>>>>>>>> good..
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> does the webserver know where .progs lives? you would need to
>>>>>>> include the full filespec if it is not where the webserver thinks
>>>>>>> it is or add the path to the httpd.conf (apache - you'll have to
>>>>>>> figure it out for yourself on IIS). To find out where the
>>>>>>> webserver thinks it should be looking, use something like this:
>>>>>>>
>>>>>>> $out = exec("pwd");
>>>>>>> echo $out ."<br>\n";
>>>>>>> or
>>>>>>> $output = `pwd`;
>>>>>>> echo $output ."<br>\n";
>>>>>>>
>>>>>>> Now, does progs live in this directory? if not, how do you expect
>>>>>>> the server to find it???
>>>>>>>
>>>>>>
>>>>>> The programm lives exactly in the directory that your short script
>>>>>> shows on.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> why it returns so strange error?:
>>>>>
>>>>>
>>>>> ./progs: syntax error at line 1: '(' unexpected
>>>>>
>>>>> ?????progs is compiled program..who can explain that?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Here is a "wierd" example from the docs:
>>>>
>>>> <?php
>>>> exec('/bin/sh -c "/bin/tar -xzf /tmp/'.$filename.'
>>>> install/desc-file install/info-file install/deps-file"');
>>>> ?>
>>>>
>>>> so yours would look like:
>>>>
>>>> exec('/bin/sh -c "/full/file/dir/progs 2 >error_log"') ;
>>>
>>>
>>>
>>>
>>> I tried this and in error_log file is the same as before that there's
>>> syntax error at line 1: '(' unexpected..
>>>
>>>>
>>>> have you tried using back-tick "`" method?
>>>
>>>
>>>
>>> no i haven't..
>>> could you let me know what the code should look like?
>>>
>>>> is the webserver owner also the owner or in the same group as the
>>>> progs file?
>>>
>>>
>>>
>>> http://www.cs.purdue.edu/help/www/using-cgi.html <--here is
>>> everything about configuration of the server i'm using..
>>>
>>>>
>>>> what is line 1 of the progs program?
>>>>
>>>
>>> i don't know cause it's already compiled program..[/color]
>>
>>
>>
>> Well if this error is in the error_file then the output is from the
>> program itself, not the web server. You will need to find out who
>> wrote the code and broke it.
>>
>> can you execute the "c" program from a command prompt (log into the
>> box and execute it?) if not, there is not much else we can do for you
>> here...[/color]
>
>
> Yes sure, i can execute this program from command line,i can even write
> this programm here cause it's very simple program written just for tests:
>
> #include <stdlib.h>
>
> int main()
> {
> printf("test");
> return 0;
> }
>
> And that's all program..
> So what can you say about that? this problem is really strange..i hope
> you'll find some clue for that cause i'm working under it 24h/day and
> still nothing..
> thanks, peter[/color]
I don't do this often, but, if you would like, send me a private email with:
ls -la progs and the directories down to progs, uid/gid of the webserver owner,
should have at least group:read access for the webserver owner.
example:
d?????? uid/gid abc
d?????? uid/gid xxxx
d?????? uid/gid yyy
-rwe?????? uid/gid progs
if you do this, you will probably find your problem also try setting the file
to permissions 777 and all of the directories (temporarily as a test) to see if
there is any difference.
--
Michael Austin.
Consultant - Available.
Donations welcomed. Http://www.firstdbasource.com/donations.html
:)
Comment