#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Posts
    94
    Rep Power
    14

    Question IIS "access denied" with php and java


    I get this error when trying to run a simple php script:

    Fatal error: Unable to load Java Library C:\j2sdk1.4.1\jre\bin\server, error: Access is denied. in c:\inetpub\wwwroot\php\java.php on line 3

    So basically php is telling me that the server, in this case IIS 5.0 is not allowing access to C:\j2sdk1.4.1\jre\bin\server\jvm.dll.

    I've tried web sharing on that directory but this isn't working. I'm afraid maybe I don't know enough about IIS management to solve this one. It seems like this kind of an issue to me.

    fyi -- the php script causin the problem is:

    PHP Code:
    <?php

    $systemInfo 
    = new Java("java.lang.System");

    print 
    "Total seconds since January 1, 1970: 
    "
    .$systemInfo->currentTimeMillis();

    ?>
    Dave
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2002
    Posts
    693
    Rep Power
    26
    IIS at install creates a user IUSR_<machinename> that the webserver runs as. You need to provide this user access.
  4. #3
  5. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    539
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2001
    Posts
    94
    Rep Power
    14
    I actually found a solution this morning...this is taken from

    http://php.networkedsystems.co.uk/ma...r/ref.java.php

    ######################################

    ** Success with W2K Server, PHP 4.3.0 as IIS5 SAPI module and J2SDK1.4.1_01 **

    After a bunch of annoyingly spurious "access violation" and "Unable to create Java Virtual Machine" errors
    I changed the php.ini setting for java.library from:

    "C:\j2sdk1.4.1_01\jre\bin\client\jvm.dll"

    to:

    "C:\j2sdk1.4.1_01\jre\bin\server\jvm.dll"

    All above examples now work perfectly incuding my own classes and those at
    http://www.onlamp.com/pub/a/php/2001/06/14/php_jav.html (thanks to emilebosch above on 18-Oct-2001 07:19).

    I'd really like to know the difference between 'client' and 'server' JVM versions if anyone can illuminate us.

    Notes:

    1. Manual install of PHP 4.3.0 to C:\php with the following relevant extracts from php.ini:

    extension=php_java.dll
    [Java]
    java.class.path = "C:\php\extensions\php_java.jar;C:\java\packages\"
    java.home = "C:\j2sdk1.4.1_01\bin"
    java.library = "C:\j2sdk1.4.1_01\jre\bin\server\jvm.dll"
    java.library.path = "C:\php\extensions"

    2. Default installation of latest Java SDK from Sun

    3. Win2K Server SP2 with all(?) patches

    4. My own classes are placed in C:\java\packages\

    Hope this helps some people.

    Regards

    -Neil

    #######################################
    Thanks Neil. Well, it looks like it might not necessarily have been a server issue.
    Dave

IMN logo majestic logo threadwatch logo seochat tools logo