UPDATE APRIL 2011:
This is an old post and as such is not current for PHP or Tomcat as they are today. Please do not follow this post’s instructions as they are now likely out of date.
More current information can be found at
http://wiki.apache.org/tomcat/UsingPhp
I would in fact now recommend simply running Quercus PHP:
http://www.caucho.com/resin-3.0/quercus/
Thank you,
-Chris.
.
.
Sometimes, you want to run PHP with Tomcat. Why? Well, you may have a legacy product, for instance, that will require servlets for many more years. Or you may be using this gigantic Java program and are only interested in adding a tiny PHP piece on the side.
There are many guides showing how to do this available, but they become outdated almost as soon as they are published. So, it’s my turn to write a short-lived guide, this time for PHP 5.2.5
Note thas this post relies greatly on information found here. Too bad even that guide got old so fast!
- Go to http://www.php.net/downloads.php and download the current version. I am going to do the setup on a Windows machine here, so I can simply download the binaries. On *nix, you will need to compile PHP. I know I will have to, anyway…
- You also need to download the corresponding PECL modules.
- Let’s assume that your current Tomcat install can be found in c:Tomcat5. Create a c:Tomcat5php directory and unzip the PHP zip file in it.
- Rename php.ini-dist, in c:Tomcat5php, to php.ini
- Extract php5servlet.dll from the PECL zip file to c:Tomcat5php
- Create a directory under c:Tomcat5webapps; in our case: phptest
- In c:Tomcat5webappsphptest, create a subdirectory: WEB-INF
- In c:Tomcat5webappsphptestWEB-INF, create web.xml with the following content:
<!--?xml version="1.0" encoding="ISO-8859-1"?--> php net.php.servlet php-formatter net.php.formatter php *.php php-formatter *.phps
- Extract/unjar (using jar xvf or WinZip) php5srvlt.jar under c:Tomcat5phptmp
- Modify both c:Tomcat5phptmpnetreflect.properties and c:Tomcat5phptmpnetservlet.properties, replacing
library=phpsrvlt
with
library=php5servlet
and save.
- Jar the content of c:Tomcat5phptmp into a new version of php5srvlt.jar
- Move php5srvlt.jar to c:Tomcat5commonlib
- Copy c:Tomcat5phpphp5servlet.dll and c:Tomcat5phpphp5ts.dll to c:windowssystem32
- Create a test page in c:Tomcat5webappsphptesttest.php with this contents:
<!--?php phpinfo(); ?-->
- Start Tomcat and go to http://localhost:8080/phptest/test.php
It should work. If it doesn’t, you can always post the stack trace here.







Hi!!
Thanks, very nice effort.
I was successful setting up php5.2.5 / tomcat5.5 on windows xp.
One small suggestion is that in step(0 or 10), instead of jar-ing/un-jar-ing I managed by renaming the php5servlet.dll to php5srvlt.dll and got ride of the famous “Unspecified Link” exception.
A point to mention is that that “TOMCAT” does not seem use system classpath, you have to feed in -Djava.library.path(for pointing to php) when you start the service on windows.
Ha! I was wondering if merely renaming the DLL would work. Thanks!
Thanks — the test.php works fine with phpinfo(), but other scripts show nothing in the browser or in the page source. Any thoughts?
Kevin
the phpinfo works BUT if you run any other *.php file they show a blank page
I was trying to run php5 on tomcat 5.0 using the above intructions. when i opened the URL for the testpage i got the following error in the file “hs_err_pid3820″ and my webpage displayed a blank page.
Can you please help me. It is urgent.
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x03b31e7b, pid=3820, tid=1824
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_15-b04 mixed mode, sharing)
# Problematic frame:
# C [php5ts.dll+0xa1e7b]
#
————— T H R E A D —————
Current thread (0x02f63808): JavaThread “http-8080-Processor25″ daemon [_thread_in_native, id=1824]
siginfo: ExceptionCode=0xc0000005, reading address 0x0000000a
Registers:
EAX=0x0000000a, EBX=0x009c1000, ECX=0x009c1000, EDX=0x0000000a
ESP=0x0390f3c4, EBP=0×00001505, ESI=0×00138200, EDI=0x009c1000
EIP=0x03b31e7b, EFLAGS=0×00010216
Top of Stack: (sp=0x0390f3c4)
0x0390f3c4: 030ec3f8 009c5054 0000001c 030056f8
0x0390f3d4: 009c1000 03b34e1b 030056f8 0000000a
0x0390f3e4: 009c1000 009c504c 0000003c 0390f424
0x0390f3f4: 00000002 030ec3f8 00000000 02d7a300
0x0390f404: 00000000 02d7a300 00000000 02e05bf0
0x0390f414: 03a983f1 009c2107 009c5010 0000001c
0x0390f424: 02e02f98 009c52e0 030ec3f8 009c4150
0x0390f434: 03f874c0 030ec3f8 03a970f9 00000001
Instructions: (pc=0x03b31e7b)
0x03b31e6b: ff 08 8b df bd 05 15 00 00 72 75 8b f7 c1 ee 03
0x03b31e7b: 0f be 10 8b cd 83 eb 08 c1 e1 05 03 cd 03 ca 40
Stack: [0x038d0000,0x03910000), sp=0x0390f3c4, free space=252k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [php5ts.dll+0xa1e7b]
[error occurred during error reporting, step 120, id 0xc0000005]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j net.php.servlet.startup()V+0
j net.php.servlet.init(Ljavax/servlet/ServletConfig;)V+24
j org.apache.catalina.core.StandardWrapper.loadServlet()Ljavax/servlet/Servlet;+717
j org.apache.catalina.core.StandardWrapper.allocate()Ljavax/servlet/Servlet;+75
j org.apache.catalina.core.StandardWrapperValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+199
j org.apache.catalina.core.StandardContextValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+285
j org.apache.catalina.core.StandardHostValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+64
j org.apache.catalina.valves.ErrorReportValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+6
j org.apache.catalina.core.StandardEngineValve.invoke(Lorg/apache/catalina/connector/Request;Lorg/apache/catalina/connector/Response;)V+42
j org.apache.catalina.connector.CoyoteAdapter.service(Lorg/apache/coyote/Request;Lorg/apache/coyote/Response;)V+154
j org.apache.coyote.http11.Http11Processor.process(Ljava/io/InputStream;Ljava/io/OutputStream;)V+611
j org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Lorg/apache/tomcat/util/net/TcpConnection;[Ljava/lang/Object;)V+113
j org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(Ljava/net/Socket;Lorg/apache/tomcat/util/net/TcpConnection;[Ljava/lang/Object;)V+45
j org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt([Ljava/lang/Object;)V+102
j org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run()V+167
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
--------------- P R O C E S S ---------------
Java Threads: ( => current thread )
0x03054910 JavaThread "TP-Monitor" daemon [_thread_blocked, id=2956]
0x02e90cd8 JavaThread “TP-Processor4″ daemon [_thread_in_native, id=2508]
0x030ad3b8 JavaThread “TP-Processor3″ daemon [_thread_blocked, id=3136]
0x030ad1a0 JavaThread “TP-Processor2″ daemon [_thread_blocked, id=1340]
0x030ad018 JavaThread “TP-Processor1″ daemon [_thread_blocked, id=1904]
0×03024408 JavaThread “http-8080-Monitor” [_thread_blocked, id=1520]
=>0x02f63808 JavaThread “http-8080-Processor25″ daemon [_thread_in_native, id=1824]
0x02d3ac98 JavaThread “http-8080-Processor24″ daemon [_thread_in_native, id=1916]
0x02d0fce0 JavaThread “http-8080-Processor23″ daemon [_thread_blocked, id=4036]
0x02d0f688 JavaThread “http-8080-Processor22″ daemon [_thread_blocked, id=3212]
0x031dcc70 JavaThread “http-8080-Processor21″ daemon [_thread_blocked, id=948]
0x031dc160 JavaThread “http-8080-Processor20″ daemon [_thread_blocked, id=820]
0x031db700 JavaThread “http-8080-Processor19″ daemon [_thread_blocked, id=2120]
0x02fe3060 JavaThread “http-8080-Processor18″ daemon [_thread_blocked, id=1296]
0x02fe2550 JavaThread “http-8080-Processor17″ daemon [_thread_blocked, id=1740]
0x02d439f8 JavaThread “http-8080-Processor16″ daemon [_thread_blocked, id=2036]
0x031c2218 JavaThread “http-8080-Processor15″ daemon [_thread_blocked, id=2304]
0x031c1ba8 JavaThread “http-8080-Processor14″ daemon [_thread_blocked, id=1968]
0x031c1220 JavaThread “http-8080-Processor13″ daemon [_thread_blocked, id=3164]
0x031bdd00 JavaThread “http-8080-Processor12″ daemon [_thread_blocked, id=2776]
0x0310ae38 JavaThread “http-8080-Processor11″ daemon [_thread_blocked, id=816]
0x0310a820 JavaThread “http-8080-Processor10″ daemon [_thread_blocked, id=2196]
0x03043c98 JavaThread “http-8080-Processor9″ daemon [_thread_blocked, id=2724]
0x03055da8 JavaThread “http-8080-Processor8″ daemon [_thread_blocked, id=1676]
0x030557c8 JavaThread “http-8080-Processor7″ daemon [_thread_blocked, id=3236]
0x02f62868 JavaThread “http-8080-Processor6″ daemon [_thread_blocked, id=3284]
0x03025c08 JavaThread “http-8080-Processor5″ daemon [_thread_blocked, id=420]
0x02d3fc30 JavaThread “http-8080-Processor4″ daemon [_thread_blocked, id=2356]
0x031ddc38 JavaThread “http-8080-Processor3″ daemon [_thread_blocked, id=340]
0x031dd6b0 JavaThread “http-8080-Processor2″ daemon [_thread_blocked, id=396]
0x02fe3d50 JavaThread “http-8080-Processor1″ daemon [_thread_blocked, id=4088]
0x0304a880 JavaThread “ContainerBackgroundProcessor[StandardEngine[Catalina]]” daemon [_thread_blocked, id=3460]
0x00a72e00 JavaThread “Low Memory Detector” daemon [_thread_blocked, id=1004]
0x00a719e8 JavaThread “CompilerThread0″ daemon [_thread_blocked, id=2736]
0x00a70b38 JavaThread “Signal Dispatcher” daemon [_thread_blocked, id=3036]
0x00a6bba8 JavaThread “Finalizer” daemon [_thread_blocked, id=1040]
0x00a6a760 JavaThread “Reference Handler” daemon [_thread_blocked, id=1404]
0x00036da8 JavaThread “main” [_thread_in_native, id=716]
Other Threads:
0x00a47ac8 VMThread [id=2692]
0x00a74040 WatcherThread [id=2916]
VM state:not at safepoint (normal execution)
VM Mutex/Monitor currently owned by a thread: None
Heap
def new generation total 576K, used 430K [0×24020000, 0x240c0000, 0×24500000)
eden space 512K, 71% used [0×24020000, 0x2407b8a8, 0x240a0000)
from space 64K, 99% used [0x240b0000, 0x240bfff8, 0x240c0000)
to space 64K, 0% used [0x240a0000, 0x240a0000, 0x240b0000)
tenured generation total 6132K, used 3827K [0×24500000, 0x24afd000, 0×28020000)
the space 6132K, 62% used [0×24500000, 0x248bce00, 0x248bce00, 0x24afd000)
compacting perm gen total 8192K, used 4672K [0×28020000, 0×28820000, 0x2c020000)
the space 8192K, 57% used [0×28020000, 0x284b0078, 0x284b0200, 0×28820000)
ro space 8192K, 67% used [0x2c020000, 0x2c582410, 0x2c582600, 0x2c820000)
rw space 12288K, 47% used [0x2c820000, 0x2cdcf748, 0x2cdcf800, 0x2d420000)
Dynamic libraries:
0×00400000 – 0x0040d000 C:\Program Files\Java\jdk1.5.0_15\bin\java.exe
0x7c900000 – 0x7c9b0000 C:\WINDOWS\system32\ntdll.dll
0x7c800000 – 0x7c8f5000 C:\WINDOWS\system32\kernel32.dll
0x77dd0000 – 0x77e6b000 C:\WINDOWS\system32\ADVAPI32.dll
0x77e70000 – 0x77f02000 C:\WINDOWS\system32\RPCRT4.dll
0x77fe0000 – 0x77ff1000 C:\WINDOWS\system32\Secur32.dll
0x77c10000 – 0x77c68000 C:\WINDOWS\system32\MSVCRT.dll
0x6d740000 – 0x6d8de000 C:\Program Files\Java\jdk1.5.0_15\jre\bin\client\jvm.dll
0x7e410000 – 0x7e4a0000 C:\WINDOWS\system32\USER32.dll
0x77f10000 – 0x77f57000 C:\WINDOWS\system32\GDI32.dll
0x76b40000 – 0x76b6d000 C:\WINDOWS\system32\WINMM.dll
0×76390000 – 0x763ad000 C:\WINDOWS\system32\IMM32.DLL
0×10000000 – 0×10015000 C:\WINDOWS\system32\APSHook.dll
0x77f60000 – 0x77fd6000 C:\WINDOWS\system32\SHLWAPI.dll
0x77c00000 – 0x77c08000 C:\WINDOWS\system32\VERSION.dll
0x76bf0000 – 0x76bfb000 C:\WINDOWS\system32\PSAPI.DLL
0x6d300000 – 0x6d308000 C:\Program Files\Java\jdk1.5.0_15\jre\bin\hpi.dll
0x6d710000 – 0x6d71c000 C:\Program Files\Java\jdk1.5.0_15\jre\bin\verify.dll
0x6d380000 – 0x6d39d000 C:\Program Files\Java\jdk1.5.0_15\jre\bin\java.dll
0x6d730000 – 0x6d73f000 C:\Program Files\Java\jdk1.5.0_15\jre\bin\zip.dll
0x6d540000 – 0x6d553000 C:\Program Files\Java\jdk1.5.0_15\jre\bin\net.dll
0x71ab0000 – 0x71ac7000 C:\WINDOWS\system32\WS2_32.dll
0x71aa0000 – 0x71aa8000 C:\WINDOWS\system32\WS2HELP.dll
0x71a50000 – 0x71a8f000 C:\WINDOWS\system32\mswsock.dll
0x662b0000 – 0×66308000 C:\WINDOWS\system32\hnetcfg.dll
0x71a90000 – 0x71a98000 C:\WINDOWS\System32\wshtcpip.dll
0x009c0000 – 0x009c8000 C:\WINDOWS\system32\php5servlet.dll
0x03a90000 – 0x03fb2000 C:\WINDOWS\system32\php5ts.dll
0×77120000 – 0x771ab000 C:\WINDOWS\system32\OLEAUT32.dll
0x774e0000 – 0x7761d000 C:\WINDOWS\system32\ole32.dll
0×74320000 – 0x7435d000 C:\WINDOWS\system32\ODBC32.dll
0x5d090000 – 0x5d12a000 C:\WINDOWS\system32\COMCTL32.dll
0x7c9c0000 – 0x7d1d6000 C:\WINDOWS\system32\SHELL32.dll
0x763b0000 – 0x763f9000 C:\WINDOWS\system32\comdlg32.dll
0x773d0000 – 0x774d3000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03\comctl32.dll
0×20000000 – 0×20017000 C:\WINDOWS\system32\odbcint.dll
VM Arguments:
jvm_args: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file=D:\apache-tomcat-5.5.26\conf\logging.properties -Djava.endorsed.dirs=D:\apache-tomcat-5.5.26\common\endorsed -Dcatalina.base=D:\apache-tomcat-5.5.26 -Dcatalina.home=D:\apache-tomcat-5.5.26 -Djava.io.tmpdir=D:\apache-tomcat-5.5.26\temp
java_command: org.apache.catalina.startup.Bootstrap start
Launcher Type: SUN_STANDARD
Environment Variables:
JAVA_HOME=C:\Program Files\Java\jdk1.5.0_15
JRE_HOME=C:\Program Files\Java\jdk1.5.0_15
CLASSPATH=C:\Program Files\Java\jdk1.5.0_15\lib\tools.jar;D:\apache-tomcat-5.5.26\bin\bootstrap.jar
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Technologies\ATI Control Panel;C:\Program Files\HPQ\IAM\bin;D:\Work\php
USERNAME=asha
OS=Windows_NT
PROCESSOR_IDENTIFIER=x86 Family 15 Model 36 Stepping 2, AuthenticAMD
————— S Y S T E M —————
OS: Windows XP Build 2600 Service Pack 2
CPU:total 1 (cores per cpu 1, threads per core 1) family 15 model 36 stepping 2, cmov, cx8, fxsr, mmx, sse, sse2, sse3, mmxext, 3dnowext, 3dnow
Memory: 4k page, physical 392560k(51600k free), swap 942556k(394852k free)
vm_info: Java HotSpot(TM) Client VM (1.5.0_15-b04) for windows-x86, built on Feb 9 2008 01:07:28 by “java_re” with MS VC++ 6.0
@asha It’s a JVM crash. That’s always bad news. Try upgrading to a more recent version of Java, this issue may have been patched by Sun.
@Kevin & @shorif Do you have an example of PHP code that fails this way? Does it make a difference it you start your scripts with error_reporting(E_ALL)?
Tomcat doesn’t seem to fill in the _SERVER variables except for REQUEST_TIME, argv and argc. argv is an empty array. I’d like to get the various kinds of HTTP information such HTTP_USER_AGENT, HTTP_REFERER, etc. Is there anything to do? I prefer using Tomcat.
I get a ClassNotFoundException on net.php.servlet. What library or jar file is that supposed to be in?
Step 9 talks about unjarring php5srvlt.jar. In the pecl-5.2.5-win32.zip file I downloaded the name is phpsrvlt.jar. Has anyone gotten the steps to work using this jar file? Just curious why the 2 properties files haven’t been updated – the original instructions referred at the top have a date of 12/11/2004. thx!
I answered my own question (post 8). The ClassNotFoundException I had with net.php.servlet was due to an incorrect re-jarring on my part.
how did u solved this pls explain., how to do unjaring and jaring exactly
Try quercus from caucho instead. easier integration, just add the jar in the WEB-INF/lib and you are done.
On any nonexisting .php page request Tomcat (actually JVM) fails with error:
# An unexpected error has been detected by Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6da22074, pid=3224, tid=3708
#
# Java VM: Java HotSpot(TM) Client VM (10.0-b22 mixed mode, sharing windows-x86)
# Problematic frame:
# V [jvm.dll+0x1b2074]
#
# An error report file with more information is saved as:
# C:\tomcat\bin\hs_err_pid3224.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
Am I the only one with this problem?
Hey all!
I think I’m messing up the re-jarring of the php5srvlt.jar file.
Could someone give me a brief run down on how I’m supposed to do this? I’ve tried a few different ways but they all keep outputting a “java.lang.ClassNotFoundException: net.php.servlet” error.
Cheers.
Dan
All good, sorted it out.
I ended up renaming the php5servlet.dll to php5srvlt.dll and didn’t bother rejarring, works a treat.
Thanks for the great article.
Could post a linux version of this guide, and could you be specific about which PECL modules to use?
Justin
MÄÂrtiņš:::
It isn’t just you.
I get the same problem. Request a .php page that doesn’t exist and *bang* the JVM crashes and the Tomcat service explodes. (Thankfully windows service recovery options bring the service back up with only 1 min of downtime)
I’m still hunting for a way to fix this… it’s quite silly that type-o’s bring the webserver down.
hi i am getting this error after running php prg.why?after i have configure all
HTTP Status 404 – /fun/test.php
cofiguratuon:
# Go to http://www.php.net/downloads.php and download the current version. I am going to do the setup on a Windows machine here, so I can simply download the binaries. On *nix, you will need to compile PHP. I know I will have to, anyway…
# You also need to download the corresponding PECL modules.
# Let’s assume that your current Tomcat install can be found in c:\Tomcat5\. Create a c:\Tomcat5\php\ directory and unzip the PHP zip file in it.
# Rename php.ini-dist, in c:\Tomcat5\php\, to php.ini
# Extract php5servlet.dll from the PECL zip file to c:\Tomcat5\php\
# Create a directory under c:\Tomcat5\webapps\; in our case: phptest
# In c:\Tomcat5\webapps\phptest\, create a subdirectory: WEB-INF
# In c:\Tomcat5\webapps\phptest\WEB-INF\, create web.xml with the following content:
php
net.php.servlet
php-formatter
net.php.formatter
php
*.php
php-formatter
*.phps
# Extract/unjar (using jar xvf or WinZip) php5srvlt.jar under c:\Tomcat5\php\tmp\
# Modify both c:\Tomcat5\php\tmp\net\reflect.properties and c:\Tomcat5\php\tmp\net\servlet.properties, replacing
library=phpsrvlt
with
library=php5servlet
and save.
# Jar the content of c:\Tomcat5\php\tmp\ into a new version of php5srvlt.jar
# Move php5srvlt.jar to c:\Tomcat5\common\lib\
# Copy c:\Tomcat5\php\php5servlet.dll and c:\Tomcat5\php\php5ts.dll to c:\windows\system32\
# Create a test page in c:\Tomcat5\webapps\phptest\test.php with this contents:
Reply plz…..
Oh, man! So easy! What a great post. Shame that some people had trouble with it, but that’s often the case with setting up servers and such I guess.
I’ll have to try this when I get back to it
One thing I recommend for people having problems is CHECK THE VERSIONS! This article was posted almost a year ago. It may not seem like very long but one little change in either Tomcat or PHP can break the whole procedure, so it’s important that the versions people use following your instructions actually match what you did (or close enough).
Maybe won’t help anybody but always worth checking.
I am trying to run PHP 5.2.28 on Tomcat 5.5 on Fedora Core4. I also want some way to share session between PHP and Java programs. Please advice.
Hi
According to given setup instruction only phpinfo(); is working. When I am trying to execute any other .php file say I want to echo ‘Hello World’, It is showing blank page.
Hi!.
Has anybody resolve the blank page problem?.
I`ve try a lot of ways to resolve this but when I open a php page and click on a
button.submit() in browser I get a blank page, it´s driving me crazy!!!.
For example: in joomla administrator the login page seems to view correctly but
when I click on Login button a blank page is displayed.
Any idea?
Thanks!.
Paco.
I have found this error when you try to run test.php page
Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.UnsatisfiedLinkError: send
net.php.servlet.send(Native Method)
net.php.servlet.service(servlet.java:190)
net.php.servlet.service(servlet.java:214)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.27 logs.
what the solution, please
thanks for help.
test.php work correctly but others *.php not work and don’t show anything why?
@rizeq –
So, at first test.php didn’t work but then it did, and now other pages are not working? What did you do to ‘unglue’ test.php?
I haven’t played with Tomcat + PHP in a while but I would make sure that access rights are similar to that of test.php (of course these settings depend on which version of Windows you are running and I’m not a Windows guru…)
——-
I have the same problem. Did you solve this problem? If it’s true can you help me please?
1. If you see a blank page:
Check the page’s source code. Does it, by any chance, contain your whole PHP source? If so, make sure that the PHP tags you are using are recognized by Tomcat.
2. UnsatisfiedLinkError:
Could be due to looking for your php file in the wrong place. Try moving it from webapps\ to webapps\ROOT\
I solved the problem! It is needed to move all my pages into ROOT. Thanks Chris!!
Now, I’m having some problems with the use functions of PHP. I suppose that is due to extension folder link. I’m fighting with php-java-bridge and I some functions are not detected. eg. request_functions. In phpinfo() I can see that the extensions are includeed….
See you soon.
Sorry but im a bit confused. Is it okay to run php 5.x and tomcat 6? Is there any conflict with this?
Hi,
I now moved my php files to /ROOT but it displaying blank page. using this code “” in test.php. Any magical advice?
Thank you
In setting up tomcat5.x and php5.x is there a problem implementing it on windows vista? please help! thanks
Dear all, I’m currently using WAMP to execute php, its workin g well, i want to work in tomcat, can any one explain clearly, wher to download, store and execute php file. thanks to any one.
Hey,
I ma getting this error below :
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet.init() for servlet php threw exception
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Thread.java:534)
root cause
java.lang.UnsatisfiedLinkError: C:\WINDOWS\system32\php5srvlt.dll: Can’t find dependent libraries
java.lang.ClassLoader$NativeLibrary.load(Native Method)
java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1586)
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1511)
java.lang.Runtime.loadLibrary0(Runtime.java:788)
java.lang.System.loadLibrary(System.java:834)
net.php.reflect.loadLibrary(reflect.java:34)
net.php.reflect.(reflect.java:29)
net.php.servlet.init(servlet.java:157)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Thread.java:534)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
Dr_Watson or others,
Has anyone got a solution for the Tomcat crash when you access a PHP page that doesn’t exist?
can anyone tell,which file are download for given download link? please help me.
This guide was for PHP5.2.5 but you could download any 5.x version.
nice try, mr. Ravenscroft, but it seems to crash for 99% of the people. You should be more rigourous with your tests.
Regards.
Hi, thanks for your input.
This method more or less worked in February of 2008. There were of course cases where it didn’t work because it was, after all, a hack.
I certainly do not expect something written three years ago — again, a hack — to hold any water today!
-C.
test.php work correctly but others *.php not work and don’t show anything.. and write the output to stderr.txt file..?..
Gilbert,
I just edited the top of this post with more current resources. I apologize for now doing this earlier.
-Chris.
Great post, but it seems like you are missing the “\” marks in your directory examples.
You keep referencing:
c:Tomcat5php
c:Tomcat5webappsphptest
Took me a while to figure out you are trying to say:
c:\Tomcat5\php
c:\Tomcat5\webapps\phptest
followed the steps very carefully but when i go to my address,
i am having this exception
HTTP Status 500 -type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.UnsatisfiedLinkError: net.php.servlet.send(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Z)V
net.php.servlet.send(Native Method)
net.php.servlet.service(servlet.java:190)
net.php.servlet.service(servlet.java:214)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.35 logs.
Apache Tomcat/5.5.35
any way to resolve it???