php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8202 exec("java -cp classpath classname inputArgument"); has no effect
Submitted: 2000-12-11 22:57 UTC Modified: 2001-06-01 16:04 UTC
From: Lee dot Seldon at infotech dot monash dot edu dot au Assigned:
Status: Closed Package: Program Execution
PHP Version: 4.0.3pl1 OS: WinNT 4, Service pack 6, IIS 4
Private report: No CVE-ID: None
 [2000-12-11 22:57 UTC] Lee dot Seldon at infotech dot monash dot edu dot au
The command prompt line
java -cp .;C:\Java\bin;C:\Java\lib;C:\Java\lib\tools.jar;E:\Health_Info\HealthWebDirectory\Messages HTML_HL7translator E:\Health_Info\HealthWebDirectory\Messages\Discharge\Dis-2000-11-28-1.htm

runs the java class  HTML_HL7translator with input file Dis-2000-11-28-1.htm
jdk1.3 is installed and works

None of the commands in the following cause HTML_HL7translator to run:

<?php
$javaHL7 = exec("java -cp .;C:\Java\bin;C:\Java\lib;C:\Java\lib\tools.jar;E:\Health_Info\HealthWebDirectory\Messages HTML_HL7translator E:\Health_Info\HealthWebDirectory\Messages\Discharge\Dis-2000-11-28-1.htm");
echo "did exec\n";
passthru("java -cp .;C:\Java\bin;C:\Java\lib;C:\Java\lib\tools.jar;E:\Health_Info\HealthWebDirectory\Messages HTML_HL7translator E:\Health_Info\HealthWebDirectory\Messages\Discharge\Dis-2000-11-26-2.htm");
echo "did passthru\n";
$javaHL7s = system("java -cp .;C:\Java\bin;C:\Java\lib;C:\Java\lib\tools.jar;E:\Health_Info\HealthWebDirectory\Messages HTML_HL7translator E:\Health_Info\HealthWebDirectory\Messages\Discharge\Dis-2000-11-26-4.htm");
echo "did system()";
?>

[PHP] extracts
;;;;;;;;;;;;;;;;;;;;
; Language Options ;
;;;;;;;;;;;;;;;;;;;;
engine			=	On	; Enable the PHP scripting language engine under Apache
short_open_tag	=	On	; allow the <? tag.  otherwise, only <?php and <script> tags are recognized.
asp_tags		=	Off ; allow ASP-style <% %> tags
precision		=	14	; number of significant digits displayed in floating point numbers
y2k_compliance	=	Off	; whether to be year 2000 compliant (will cause problems with non y2k compliant browsers)
output_buffering	= Off	; Output buffering allows you to send header lines (including cookies)
implicit_flush		= Off	; Implicit flush tells PHP to tell the output layer to flush itself
allow_call_time_pass_reference	= On	; whether to enable the ability to force arguments to be 

safe_mode		=	Off
safe_mode_exec_dir	=
safe_mode_allowed_env_vars = PHP_			; Setting certain environment variables
safe_mode_protected_env_vars = LD_LIBRARY_PATH		; This directive contains a comma-
disable_functions	=		
; Colors for Syntax Highlighting mode.  Anything that's acceptable in <font color=???> would work.
highlight.string	=	#DD0000
highlight.comment	=	#FF8000
highlight.keyword	=	#007700
highlight.bg		=	#FFFFFF
highlight.default	=	#0000BB
highlight.html		=	#000000

; Misc
expose_php	=	On		
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;

max_execution_time = 30     ; Maximum execution time of each script, in seconds
memory_limit = 8M			; Maximum amount of memory a script may consume (8MB)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; error_reporting is a bit-field.  Or each number up to get desired error reporting level
E_ALL				- All errors and warnings

error_reporting	=	 E_ALL; display all errors, warnings and notices
display_errors	=	Off	; Print out errors (as a part of the output)
	
display_startup_errors = Off		; Even when display_errors is on, errors that occur during
log_errors		=	On	
track_errors	=	Off	; Store the last error/warning message in $php_errormsg (boolean)
error_log	= E:\Health_Info\HealthWebDirectory\php_error.txt ; log errors to specified file
warn_plus_overloading	=	Off		; warn if the + operator is used with strings
;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;;;;;;;;
; Note - track_vars is ALWAYS enabled as of PHP 4.0.3
variables_order		=	"EGPCS"	; This directive describes the order in which PHP registers
register_argc_argv	=	On		; This directive tells PHP whether to declare the argv&argc	
post_max_size		=	8M		; Maximum size of POST data that PHP will accept.
gpc_order			=	"GPC"	; Thi
magic_quotes_gpc	=	On		; magic quotes for incoming GET/POST/Cookie data
magic_quotes_runtime=	Off		; magic quotes for runtime-gener
magic_quotes_sybase	=	Off		; Use Sybase-style ma
auto_prepend_file	=
auto_append_file	=

; PHP's built-in default is text/html
default_mimetype = "text/html"
;default_charset = "iso-8859-1"
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
include_path	=                   ; UNIX: "/path1:/path2"  Windows: "\path1;\path2"
doc_root		=	; the root of the php pages, used only if nonempty
user_dir		=	; the directory under which php opens the script using /~username, used only if nonempty
extension_dir	=	./	; directory in which the loadable extensions (modules) reside
enable_dl		= On	; Whether or not to enable the dl() function.
		; The dl() function does NOT properly work in multithreaded
		; servers, such as IIS or Zeus, and is automatically disabled on them.
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
file_uploads	= On				; Whether to allow HTTP file uploads
upload_tmp_dir = C:\Program Files\Php4\uploadtemp  ; temporary directory for HTTP uploaded files (will use system default if not specified)
upload_max_filesize = 2M		    ; Maximum allowed size for uploaded files
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
extension=php_java.dll
;;;;;;;;;;;;;;;;;;;
; Module Settings ;
;;;;;;;;;;;;;;;;;;;

[Syslog]
define_syslog_variables	= Off	; Whether or not to define the various s

[mail function]
SMTP		=	 smtp.monash.edu.au ; for Win32 only
sendmail_from	=	 Lee.Seldon@infotech.monash.edu.au ; for Win32 only

[Debugger]
debugger.host	=	localhost
debugger.port	=	7869
debugger.enabled	=	False

[Logging]

[Java]
java.class.path = extensions\jdk1.3\php_java.jar
java.home = c:\java
java.library = c:\java\jre\bin\hotspot\jvm.dll 
java.library.path = .\

[SQL]
sql.safe_mode	=	Off

[ODBC]
uodbc.allow_persistent	=	On	; allow or prevent persistent links
uodbc.check_persistent  = 	On	; check that a connection is still validbefore reuse
uodbc.max_persistent	=	-1	; maximum number of persistent links. -1 means no limit
uodbc.max_links			=	-1	; maximum number of link
uodbc.defaultlrl	=	4096	; Handling of LONG fields. Returns number of bytes
uodbc.defaultbinmode	= 	1	; Handling of binary data. 0 means passth

[Session]
session.save_handler      = files   ; handler used to store/retrieve data
session.save_path         =  C:\Program Files\Php4\sessiondata    ; argument pass
session.use_cookies       = 1       ; whether to use cookies
session.name              = PHPSESSID  
session.auto_start        = 0       ; initialize session on request startup
session.cookie_lifetime   = 0       ; lifetime in seconds of cookie
session.cookie_path       = /       ; the path the cookie is valid for
session.cookie_domain     =         ; the domain the cookie is valid for
session.serialize_handler = php     ; handler used to serialize data
session.gc_probability    = 1       ; percentual probability that the 
session.gc_maxlifetime    = 1440    ; after this number of seconds, stored
session.referer_check     =         ; check HTTP Referer to invalidate 
session.entropy_length    = 0       ; how many bytes to read from the file
session.entropy_file      =         ; specified here to create the session id
session.cache_limiter     = nocache ; set to {nocache,private,public} to
session.cache_expire      = 180     ; document expires after n minutes
session.use_trans_sid     = 1       ; use transient sid support if enabled

; End:


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-24 12:40 UTC] jmoore@php.net
are you not getting any errors?? Can you try exec with other programs and see if it happens with them?

Not getting a unable to fork eror are you? what SAPI are you using ISAPI or CGI?
 [2001-03-14 04:34 UTC] Lee dot Seldon at infotech dot monash dot edu dot au
ID 8202
I don't get any error messages.
A student of mine tried the code on his system, and claimed it worked. 
Using 4.0.3 as CGI installation

Not urgent - our work-around -> re-wrote the Java code in PHP, and that works.
Lee

 [2001-03-14 15:08 UTC] sniper@php.net
Can you please tell which SAPI you're using, ISAPI or CGI?

--Jani

 [2001-03-14 17:18 UTC] Lee dot Seldon at infotech dot monash dot edu dot au
Using CGI, i.e. php.exe with the correspondng extension (.php) in the IIS 4 list pointing to php.exe %s %s
C:\Java\bin, etc are in the CLASSPATH (system environment setup)
 [2001-05-07 12:16 UTC] sbergmann@php.net
Does your problem persist with PHP 4.0.5? Have you considered using PHP 4's Java extension to directcly invoke your Java class?

 [2001-06-01 16:04 UTC] sniper@php.net
No feedback. Consider updating to PHP 4.0.6 when it is released.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 23:01:27 2024 UTC