Re: Problem to launch a program with system()
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.php archive

Re: Problem to launch a program with system()

From: Colin McKinnon <colin.thisisnotmysurname@ntlworld.deletemeunlessURaBot.com>
Date: Sun Apr 30 2006 - 23:16:57 CEST

sylsau wrote:

> Hello,
>
> I wrote a JAVA program which uses the JAVA API JDOM 1.0 (of this site
> www.jdom.org)
> I put the archive jdom.jar in the directory /usr/share/java/jdom.jar
> and I added this path in the CLASSPATH variable.
> The program runs normally when I launch it in a unix shell.
>
> Now, I want to launch this JAVA program in a PHP program with system()
> function for example. I have an Apache server with PHP 4 who runs. The
> variable safe_mode of PHP is at off. So, the program PHP can launch
> executable program.
>

<snip>
> On my computer, Apache runs on the user www-data. And i tried to
> execute my program JAVA on this user and it runs normally. Besides, the
> CLASSPATH of the user www-data contain the path to jdom.jar
>
> This is the error message (contained in the file test.txt) after the
> execution of the PHP program :
>
> test
> Step 1
> FAILED
> java.lang.NoClassDefFoundError: org/jdom/input/SAXBuilder
> at Test.main(Test.java:51)
>

So check the CLASSPATH environment variable from within PHP. If its not
there. set it before running your java prog.

C.
Received on Mon May 1 03:08:04 2006