imagemagick - Running exec() from PHP not working -
this works within php code
$output = array(); exec("ls /applications/xampp/htdocs/my_app/images", $output); var_dump($output);
now need utilize imagemagick's "convert" command convert png file pdf file. next doesn't , returns no errors.
$output = array() exec("convert /applications/xampp/htdocs/my_app/images/test.png /applications/xampp/htdocs/my_app/images/test.pdf", $output); var_dump($output);
is permission issue? gave chmod 777 images folder. else should check? when run command terminal, works fine.
if php code beingness executed via web server (e.g. apache) apache process (httpd) might running under restricted unix user (e.g. apache or httpd). restricted unix user wouldn't have write permissions in /applications/xampp/htdocs/my_app/images/
directory you're trying generate pdf. seek command instead , see if works:
exec("convert /applications/xampp/htdocs/my_app/images/test.png /tmp/test.pdf", $output); var_dump($output);
above command tries generate pdf in /tmp
directory writable apache unix user.
i note you've given 777 images folder. pls understand chmod 777 images folder lone not enough. need give write permission apache user in parent directories e.g. my_app, htdocs, xampp, applications etc big security risk, must add.
php imagemagick
No comments:
Post a Comment