0

I have this code running in CentOS 5.5 ,PHP 5.1.6 ,Apache/2.2.3 ,ImageMagick 6.2.8

$convert = "/usr/bin/convert";
$command = "$convert -size 100x100 xc:blue mytest.jpg";
$test_image = exec($command);
echo "<img src=\"mytest.jpg\">";

when i run the php tester i dont get the image created , only the echo string printed on page as html.
but when i run the same command as onliner the image does created just fine.

/usr/bin/convert -size 100x100 xc:blue mytest.jpg

what is wrong here i can't tell.

2 Answers 2

1

Your PHP assumes that the web server has permissions to execute programs and to write to the current directory. You should use popen() to send the image to stdout and either use the data: scheme to embed the image data into the HTML, or put the PHP script as the src for the img tag and output the appropriate header and then the image data.

Sign up to request clarification or add additional context in comments.

4 Comments

the image doesn't created before the html
the convert -size 100x100 xc:blue mytest.jpg from php dont create the image mytest.jpg
hi i did .. and it was working .. but now its stooped to work. i have no idea way .
ok now i can't even create simple file in the directory , and the directory has all permissions , does it netter if im using root account ?
0

Does PHP, the user, have permission to do that?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.