PDA

View Full Version : php cgi and exec



fmen
04-16-2009, 01:50 AM
I have build PHP as CGI but now the function exec says with every command like uptime this error: [Thu Apr 16 10:28:37 2009] [error] [client xxx.xxx.xxx.xxx] sh: uptime: command not found
This also happens when I do the command convert (yes Imagemagick is installed). Strange enough when I login with the permissions of the exame user I can do the commands through SSH without any problem.

I use DirectAdmin with custombuild. How can I resolve this? Am I required to build PHP to CLI to use the exec command?

scsi
04-16-2009, 10:09 AM
Post the exact php line you are calling.

fmen
04-16-2009, 10:10 AM
exec("uptime");
that's all;-)

scsi
04-16-2009, 10:15 AM
Enter the full path to the uptime command.

Example: /usr/bin/uptime

fmen
04-16-2009, 10:18 AM
That is not the problem, but I have already build PHP to CLI because I had some more problems with it like 1.83MB file upload which didn't works. The settings are good, the file upload settings are the exame as the CLI version but it returned on $_FILES['tmp_name'] [error].

fmen
04-20-2009, 10:12 PM
I have installed the cgi build again on another server and you (scsi) are right that I have to fill in the full path. But I have still another error when I upload a file:

Array ( [name] => Creek.jpg [type] => image/jpeg [tmp_name] => /home/henk/tmp/phpqdBN5y [error] => 0 [size] => 264409 )

What could be the problem?

fmen
04-21-2009, 08:34 AM
Problem solved :-)

tillo
04-21-2009, 08:37 AM
If the problem was related to PHP-CGI I suggest you write here how did you fix it, so that anyone having the same problem can learn from you. :)

fmen
04-21-2009, 08:38 AM
I don't now that the problem was, I have rebuild it and now the problems are solved :-)