Page 1 of 1

shell_exec

Posted: Wed Oct 18, 2006 5:27 pm
by catalaur
Hi everyone!
I have compile.php witch containes:

Code: Select all

<?php
$shell_return=shell_exec("/usr/local/bin/fpc -Xs /var/www/localhost/htdocs/prog/BAZA2.PAS");
echo nl2br($shell_return);
?>
This returns:

Code: Select all

Free Pascal Compiler version 2.0.4 [2006/08/20] for i386
Copyright © 1993-2006 by Florian Klaempfl
Target OS: Linux for i386
Compiling /var/www/localhost/htdocs/prog/BAZA2.PAS
BAZA2.PAS(5,4) Warning: Variable "i" does not seem to be initialized
BAZA2.PAS(1,6) Note: Local variable "n" is assigned but never used
Linking /var/www/localhost/htdocs/prog/BAZA2
BAZA2.PAS(6,1) Error: Error while linking
Error: /usr/local/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)
If i do this command directly on linux console it returns:

Code: Select all

/usr/local/bin/fpc -Xs /var/www/localhost/htdocs/prog/BAZA2.PAS
Free Pascal Compiler version 2.0.4 [2006/08/20] for i386
Copyright © 1993-2006 by Florian Klaempfl
Target OS: Linux for i386
Compiling /var/www/localhost/htdocs/prog/BAZA2.PAS
BAZA2.PAS(5,4) Warning: Variable "i" does not seem to be initialized
BAZA2.PAS(1,6) Note: Local variable "n" is assigned but never used
Linking /var/www/localhost/htdocs/prog/BAZA2
5 Lines compiled, 0.1 sec

Apache has rights to write/execute on fpc
Any idea?

Posted: Wed Oct 18, 2006 5:34 pm
by pickle
This may seem like a silly question, but does Apache have rights to the /var/www/localhost/htdocs/prog/ directory?

Posted: Thu Oct 19, 2006 5:08 am
by catalaur
Yes it has. Anyway i solved that problem. I saw that fpc creates 3 new files in the folder where the script is located, that folder wasn't writeble by apache .