shell_exec

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
catalaur
Forum Newbie
Posts: 6
Joined: Sat Jul 15, 2006 2:00 pm

shell_exec

Post 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?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

This may seem like a silly question, but does Apache have rights to the /var/www/localhost/htdocs/prog/ directory?
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
catalaur
Forum Newbie
Posts: 6
Joined: Sat Jul 15, 2006 2:00 pm

Post 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 .
Post Reply