0

i want to convert file.svg to file.png through batik library. i run command on shell for it, it run correctly. but by running same command in php by php function shell_exec($command), the return output is empty. my command which i want to execute through php is :

$result = shell_exec('java -jar "/var/www/CA_FQA_1_1/js/components/batik-1.7/batik-rasterizer.jar" -m image/png -d "/var/www/CA_FQA_1_1/designPNGS/batik3D.png" -w 2000 "/var/www/CA_FQA_1_1/svgFiles/batik3D.svg"');
echo $result;

the $result is empty. i also increase maximum time execution in

apache php.ini

. but still $result return empty and no png is created. command is running correctly on linux terminal. Question: ** What is problem here. help me?**

sarfraz
  • 27
  • 8
  • 1
    Have you checked if the PHP user is allowed to run the `java` command? – h2ooooooo May 24 '13 at 12:02
  • also, are you trying to execute the PHP code on the same system where you tried it from linux terminal? If not, you should check to see if e.g. java is in path, etc (on top of access rights as @h2ooooooo mentioned) –  May 24 '13 at 12:05
  • how can i checked if the PHP user is allowed to run java command?@h2ooooooo – sarfraz May 24 '13 at 12:10
  • 2
    i also check with giving full path '/usr/bin/java' and full access rights – sarfraz May 24 '13 at 12:13
  • the other big thing to look for is environment variables that you may have set up on your shell account. A lot of these won't be available to the webserver. – Orangepill May 24 '13 at 12:17
  • @sarfraz First you test [who the PHP user is](http://stackoverflow.com/questions/7771586/how-to-check-what-user-php-is-running-as), and then you can log in as an administrator on your server and run `su PHPUSER` (if running Linux), and then try to run your command. – h2ooooooo May 24 '13 at 12:17
  • **su PHPUSER ** command is not running answer by linux shell is unknow id : PHPUSER@h2ooooooo – sarfraz May 26 '13 at 04:40
  • how to look look for is environment variables that you may have set up on your shell account. @Orangepill – sarfraz May 26 '13 at 04:42
  • You can inspect the `$_ENV` superglobal on the php side... in the shell account just type `env` – Orangepill May 26 '13 at 04:45

1 Answers1

0

Please check folder path permission .Also please check apache2 error log var/log/apache2/error.log to get more information regarding this

JageshMk
  • 21
  • 1
  • 6