Jump to content
The Uniform Server Community

Javascript extension in PHP5


Recommended Posts

I am running Uniform Server 3.3 (standard configuration) on a Windows XP platform. (This includes PHP, Apache 2.0.58 as it comes straight from the download site).


There are questions all over the web that pertain to enabling the additional functionality that has been built into php5. I seem to be having the same problems as all of these people, and I'm not quite sure why the implementation of PHP extensions is so hard!


Specifically, I am failing to enable Javascript properly in PHP (using the php_java.dll extension). Here is what I am doing:

- uncomment php_java.dll in my php.ini file

- ensure that: extension_dir = "/usr/local/PHP/extensions"

- download the PECL files for

- unzip and extract php_java.dll into the /extensions file in diskw/usr/local/php/extensions

- I also extracted php_java.jar to the extensions directory as well, even though I do not think it must be there


When I try to run the following script (that I named example.php):



// get instance of Java class java.lang.System in PHP

$system = new Java('java.lang.System');


// demonstrate property access

echo 'Java version=' . $system->getProperty('java.version') . '<br />';

echo 'Java vendor=' . $system->getProperty('java.vendor') . '<br />';

echo 'OS=' . $system->getProperty('os.name') . ' ' .

$system->getProperty('os.version') . ' on ' .

$system->getProperty('os.arch') . ' <br />';


// java.util.Date example

$formatter = new Java('java.text.SimpleDateFormat',

"EEEE, MMMM dd, yyyy 'at' h:mm:ss a zzzz");


echo $formatter->format(new Java('java.util.Date'));



I get the commonly found error:


Fatal error: java() [function.java]: Unable to load Java Library jvm.dll, error: The specified module could not be found. in W:\www\example.php on line 3


I understand that jvm.dll is a file that is required for PHP<=4.x, why is it being called in PHP5? I would entertain using a plugin, but the link for the Tomcat and Resin downloads lead nowhere on the Uniform Server website.


In summary, why is it that these extensions rarely work and people have so many problems with them? Can someone maybe provide a list of common mistakes that are encountered, and corrections to misconceptions on these fixes?


Thanks in advance.

Link to comment
Share on other sites

  • 1 month later...

Sorry for the delay. The PHP extensions actually work alright, just have to figure whats wrong with the one you are trying to use. It seems like the plugin loaded but the problem is the jvm.dll. Will look more into that for you as soon as you give me a buzz back on what Java you have installed on your PC. The JDK or the JRE?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...