You are here: Trying to execute Java command on server via PHP « All PHP « IT news, forums, messages
Trying to execute Java command on server via PHP

Posted by Good Man on 10/13/64 11:36

Hi there

I am trying to execute a custom-built java program on my linux server via
PHP. Basically, a user uploads files via PHP, and then the java program
performs some action on these files.

I have successfully had other operations performed on these files by
using backticks, ie:
$doit = `my exec command`;

....because i have found that exec('my exec command'); never really works
properly.


To troubleshoot, I have had each 'command' echo'd to the screen. If I
copy and paste my command into the server's terminal window (via SSH),
everything works properly. However, nothing at all is happening when the
script is trying to issue the command.

For example, the command that PHP gets is:
java -classpath /myDir:/myDir/CADViewer.jar CADViewer /myDir/
/myDir/conversions/3857/floor_1_chart.dwf
/myDir/conversions/3857/floor1.txt

When that command is echo'd to my screen and I paste that into my
terminal window, the action is performed.

I don't think this is a server permissions issue as all files/JARs
involved are CHMOD'ed properly for execution/writing by the apache
'user'. Nor do I think this is a 'directory' restrictive thing, because I
can type that command regardless of the directory I am in and have it
work properly (as absolute paths are specified).

Does anyone have any tips? Why would the command be working from the
terminal window but not from the PHP script?

Thanks!!

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация