[PHP] PHP --with-java problem

2002-04-12 Thread Dmitri Zakharov

I am trying to configue PHP with Java support.
with PHP-4.1.2, JDK1.3.1_01

The installation goes smoothly. My php.ini file 
contains the follwing section for Java



[Java]
java.class.path = /usr/local/src/php-4.1.2/ext/java/php_java.jar
java.home = /usr/local/jdk1.3.1_01
java.library = /usr/local/jdk1.3.1_01/jre/lib/i386/server/libjvm.so
;java.library.path = .\
extension_dir = /usr/lib/php4
extension = libphp_java.so



phpinfo() function output shows me Java section OK.
BUT, when I run a simple example from 'ext/java/jver.php'
(available with PHP distribution), Netscape gives me an 
error box with a message:

"The document contained no data.
Try again later or contact the server's administrator."

Here's the code for jver.php I'm trying to run:


test

Java Test
Java Test
  $system = new Java("java.lang.System");
  print "Java version=".$system->getProperty("java.version")." \n";
  print "Java vendor=".$system->getProperty("java.vendor")." \n\n";
  print "OS=".$system->getProperty("os.name")." ".
  $system->getProperty("os.version")." on ".
  $system->getProperty("os.arch")." \n";

  $formatter = new Java("java.text.SimpleDateFormat",
",  dd,  'at' h:mm:ss a ");

  print $formatter->format(new Java("java.util.Date"))."\n";
// - */

?>



Obviously, there's somthing still wrong with PHP/Java configuration
Anybody has the same problem?  Any suggestions?

Any help is appreciated,
Thanks

-- 
zakd

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] Re: How to detect if cookies are enable?

2001-11-20 Thread Dmitri Zakharov

Pekesan wrote:
> 
> Does anyone know how to detect if the client browser allows cookies or not?
> 
> Thanks in advance.

Here's one way to do that
(This is from 'Professional PHP Programming' published by Wrox Press):

Step 1: 
  - send a set-cookie request
  - reload current page

Step 2:
  - check whether set-cookie request was successful



if (empty($check)) {
$page = "$PHP_SELF?check=1";
header("Location: $page");
setcookie("testcookie", "1");
} else {
if (empty($testcookie)) {
echo "Could not set test cookie. You browser has disabled
cookies support.";
} else {
    echo "Your browser supports cookies
}
}



Hope that helps. ;)

-- 
Dmitri Zakharov
email: [EMAIL PROTECTED]
phone: (514)938-7389

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]