Running php 5.x επάνω Windows χρησιμοποιώνταs tomcat 4.x ή 5.x
What αυτό λύνω:
- χρησιμοποιώνταs php 5.x επάνω Tomcat 4.x ή 5.x
- επιτρέπω php μόνο μέσα έναs web αίτηση, αντί για καθολικός.
The απλό πιθανά configuration is περιέγραψα. The περιγραφή είναι terse αναλαμβάνω δικό σου intelligence.
εμείs θα αναλάβω php θα να είμαι εγκατέστησα μέσα c:\ οδηγώ. υποκατάστατο με οδηγώ γράμμα του δικό σου choice.
οδηγίεs
- κατεβάζω αργά php 5.x zip αρχείο.
εγώ μεταχειρισμένοςhttp:/www.php.net/αποκτώ/php-5.0.2-Win32.zip/ από/ έναs/ καθρέφτηs/ . - κατεβάζω αργά συλλογή του PECL υποδομή προτύπου. εγώ μεταχειρισμένοςhttp:/www.php.net/αποκτώ/pecl-5.0.2-Win32.zip/ από/ έναs/ καθρέφτηs/ .
- Unzip php 5.x zip αρχείο οπουδήποτε, κανονικά cphp:\
- αντίγραφο php.ini- απόσταση, μέσα cphp:\, όπως php.ini
- ασυνήθιστος the ουρά ( απομακρύνω semi- κόλον στο beginning) μέσα php.ini:
extensionphp_java.dll;= - εκχύλισμα php5servlet.dll από pecl zip αρχείο σε cphp:\ (Uncheck " χρήση ντοσσιέ όνομα" μέσα WinZip).
εξασφαλίζω ότι the αρχείο is πραγματικά παρουσία μέσα cphp:\ - εγκαθιστώ Tomcat και δημιουργώ έναs κατάλογος κάτω webapps. Lets λέω είναι όνομα fun.
- δημιουργώ WEB-INF κατάλογος κάτω fun
- δημιουργώ lib κατάλογος κάτω WEB-INF
- δημιουργώ web.xml κάτω WEB-INF μαζί με επόμενος περιεχόμενα:
php net.php.servlet php- σχήμα net.php.formatter php *.php php- σχήμα *.phps - εκχύλισμα php5srvlt.jar και εκχύλισμα/unjar ( βάζο xvf …) αυτό κάτω c:\
- τροποποιώ αμφότεροι the αρχείο reflect.properties και servlet.properties σε αλλάζω the ουρά libraryphpsrvlt= σε libraryphp5servlet= και σώζω αυτούς. This υποδεικνύω the όνομα αρχείου του dll αρχείο ο οποίος is γεμάτος με το Java αίτηση υπηρετώ the αίτηση. μέσα my εκδοχή the όνομα του dll was php5servlet.dll. δικό σου μίλι μπορώ ποικίλω. This έχει όχι σύνδεση μαζί με όνομα του βάζο αρχείο ο οποίος μπορώ να είμαι οτιδήποτε.
- Re- δημιουργώ the βάζο αρχείο
- αντίγραφο the βάζο αρχείο σε WEB-INFlib\ κατάλογος δημιούργησα νωρίτερα
- προσθέτω cphp:\ σε δικό σου σύστημα ή User παθητικός μέσα Windows enironment (Hint: σωστός- κλικ και διαλέγω ιδιοκτησία, περιουσία από My υπολογιστήs)
- δημιουργώ έναs αρχείο test.php κάτω fun μαζί με επόμενος code:
- αρχή Tomcat ( πηγαίνω στο [Tomcat εγκατάσταση κατάλογος]\ και δακτυλογραφώ Tomcat).
- ανοίγω δικό σου βόσκω και πηγαίνω στο http:/localhost8080:/fun/test.php /
- εξασφαλίζω ότι υπάρχουν όχι errors εξέθεσα. αντί you αποκτώ έναs πληροφορία οθόνη με php εκδοχή πληροφορία και ολόκληρος lot του λεπτομέρεια
πεs μου εάν this έγγραφο is βοήθεια σε you.
εκσυγχρονίζω φτιαγμένος ασήμαντος επανάληψη σε highlight μερικά κλειδί elements.
λύσεις σε κοινός πρόβλημα από users:
οποιόσδήποτε is getting this error βjava.lang.UnsatisfiedLinkError: όχι php5servlet μέσα java.library.pathβ. παρακαλώ ελέγξτε το δύο ιδιοκτησία, περιουσία αρχείο, κατά πόσον υπάρχουν οποιοσδήποτε κενό διάστημα. εγώ was stuck σε αυτό πρόβλημα για 2 ημέρες. εκεί θα να είμαι μόνο έναs ουρά, και όχι κενό διάστημα. ελέγχω αυτό τώρα!!!. αυτό είναι πού the πρόβλημα is ψευδής.
–Arundhati
The εκδοχή του php και pecl μουστάκι να είμαι το ίδιο.
–Mirek Mocek
You μπορεί θέλω σε προσθέτω έναs ξανακλωτσώ σκαλί στο τέλος του δικό σου οδηγίεs. αυτό θα εξαλείφω πολύ από the πρόβλημα μαζί με unsatisfied σύνδεσμος errors.
– ήχος πλαταγιάσματος της γλώσσας Rosendahl
σημείωση:
εάν you βρίσκω this προπαρασκευαστικός χρήσιμος, παρακαλώ θεωρώ δωρεά και απολαμβάνω the ευχαρίστηση του giving.
αρχείο κάτωπροβολέας νέα, πωs σε, Java λογισμικό, PHP, τεχνολογία, Web, Web υπηρεσία |
|
RSS 2.0 |
Trackback this άρθρο |
ηλεκτρονικό ταχυδρομείο this άρθρο
μπορείs επίσηs αρέσω διαβάζω |
The σχόλιο είναι τώρα κλειστός για this ταχυδρομώ.



Δεκέμβριοs 20th, 2004 σε 841: είμαι
εγώ προσπάθησα this b4 (http:/analogueboy.blogspot.com/#106959689637832829) μα αυτό wasnt’ πολύ reliable. εγώ προσπάθησα σε τρέχω phpbb κάτω tomcat και αυτό επανέλαβα απέτυχα. έχω you βρήκα the διαδικασία σε να είμαι περισσότερο reliable κάτω php5?
Δεκέμβριοs 20th, 2004 σε 127: pm
The σύστημα was stable so μακρύς you didnt’ έχω ξαναφορτώνω the web αίτηση. μέσα στο δίνω εγκατάσταση scenario the βάζο ο οποίος γεμάτος the ιθαγενήs dll is γεμάτος από το web αίτηση έρχομαι σε επαφή. So re- φόρτωση web αίτηση προκαλώ πρόβλημα. είναι καλύτερος σε αναπαύομαι Tomcat. οπωσδήποτε εγώ υποθέτω αυτό θα είναι όλο κατεστραμένος εάν the βάζο is κινώ σε κοινός/lib.
Δεκέμβριοs 28th, 2004 σε 743: είμαι
εγώ m getting this error
javax.servlet.ServletException: υπηρετώ εκτέλεση threw έναs εξαίρεση
ρίζα προκαλώ
java.lang.UnsatisfiedLinkError: στέλνω
net.php.servlet.sendNative( μεθανόλη)
net.php.servlet.serviceservlet.java190(:)
net.php.servlet.serviceservlet.java214(:)
javax.servlet.http.HttpServlet.serviceHttpServlet.java802(:)
Δεκέμβριοs 30th, 2004 σε 220: είμαι
# εκχύλισμα php5srvlt.jar και εκχύλισμα/unjar ( βάζο xvf β¦) αυτό κάτω c:\
WHAT κάνω YOU εννοώ από THIS λιγνίτης
# τροποποιώ αμφότεροι the αρχείο reflect.properties και servlet.properties σε αλλάζω the ουρά libraryphpsrvlt= σε libraryphp5servlet= και σώζω αυτούς
εδώ εγώ CANT’ βρίσκω αντανακλώ και SERVLET.PROPERTIES?
# Re- δημιουργώ the βάζο αρχείο
εδώ επίσηs μάγισσα αρχείο
# αντίγραφο the βάζο αρχείο σε WEB-INFlib\ κατάλογος δημιούργησα νωρίτερα
# προσθέτω cphp:\ σε δικό σου σύστημα/User παθητικός μέσα Windows enironment (Hint: σωστός- κλικ και διαλέγω ιδιοκτησία, περιουσία από My υπολογιστήs)
# δημιουργώ έναs αρχείο test.php κάτω fun μαζί με επόμενος code:
# αρχή Tomcat ( πηγαίνω στο [Tomcat εγκατάσταση κατάλογος]\ και δακτυλογραφώ Tomcat).
# ανοίγω δικό σου βόσκω και πηγαίνω στοhttp:/localhost8080:/fun/test.php/
# εξασφαλίζω ότι υπάρχουν όχι errors εξέθεσα. αντί you αποκτώ έναs πληροφορία οθόνη με php εκδοχή πληροφορία και ολόκληρος lot του λεπτομέρεια
εγώ βρίσκω THIS μέσα Διαδίκτυο = αυτό DOESN’
T δουλειά
the php5 εκδοχή του phpsrvlt.jar is δεν δουλεύει διορθώνω εξαιτίας έναs
λάθος μέσα
netphpreflect.properties\\
και
netphpservlet.properties\\
εκεί’ έναs διάστημα μετά the βιβλιοθήκη όνομα ότι θα να είμαι έβγαλα.
μετά doing this ive’ κανένα πρόβλημα χρησιμοποιώνταs php5 έξω του έναs java appserver.
mfg,
28 Oct 130pm: CEST] MerlinDMC σε t-online dot de
μπορείs να με βοηθήσειs παρακαλώ
Δεκέμβριοs 30th, 2004 σε 230: είμαι
Etat HTTP 500
——————————————————————————–
δακτυλογραφώ Rapport dexception’
μήνυμα
περιγραφή Le υπηρετώ έναs rencontrΓ© une erreur περιόρισα () qui la’ empΓͺchΓ© de satisfaire la requΓͺte.
εξαίρεση
javax.servlet.ServletException: LexΓ©cution’ de la υπηρετώ έναs lancΓ© une εξαίρεση
προκαλώ mΓ¨re
java.lang.UnsatisfiedLinkError: στέλνω
net.php.servlet.sendNative( μεθανόλη)
net.php.servlet.serviceservlet.java190(:)
net.php.servlet.serviceservlet.java214(:)
javax.servlet.http.HttpServlet.serviceHttpServlet.java853(:)
σημείωση La τρακτέρ complΓ¨te de la προκαλώ mΓ¨re de cette erreur est disponible dans les fichiers εφημερίδα de Apache Tomcat/5.5.6.
Ιανουάριοs 2nd, 2005 σε 259: pm
εγώ dont’ understand Ισπανόs. οπωσδήποτε εγώ πιστεύω the περιεχόμενα του δύο σχόλιο επάνω είναι το ίδιο UnsatisfiedLinkError.
όπως the βάζο αρχείο is γλώσσα κάτω web-inf/lib κατάλογος realoding the web περιέχων προκαλώ the dll σε να είμαι ξαναφόρτωσα πάλι ο οποίος αποτυγχάνω.
The απλό λύση is σε αναπαύομαι the υπηρετώ οποτεδήποτε υπάρχει έναs χρειάζομαι σε αναπαύομαι the web conatiner. οπωσδήποτε εξαλείφω the πρόβλημα σύνολο εσύ μπορείs γλώσσα the βάζο κάτω κοινός/lib κατάλογος. ότι δρόμος είναι γεμάτος the tomcat classloader και is όχι restarted πότε the web περιέχων is restarted.
πεs μου εάν ότι βοήθεια.
Ιανουάριοs 2nd, 2005 σε 305: pm
λογαριασμόs> the php5 εκδοχή του phpsrvlt.jar is δεν δουλεύει διορθώνω εξαιτίας έναs λάθος μέσα netphpreflect.properties\\ και netphpservlet.properties\\. Thereβs έναs διάστημα μετά the βιβλιοθήκη όνομα ότι θα να είμαι έβγαλα. μετά doing this iβve κανένα πρόβλημα χρησιμοποιώνταs php5 έξω του έναs java appserver.
The πρόβλημα έχει been απευθυνόμενος μέσα βήματα 11-13 επάνω ( μνημονεύω υπό για convenience):
11. εκχύλισμα php5srvlt.jar και εκχύλισμα/unjar ( βάζο xvf β¦) αυτό κάτω c:\
12. τροποποιώ αμφότεροι the αρχείο reflect.properties και servlet.properties σε αλλάζω the ουρά libraryphpsrvlt= σε libraryphp5servlet= και σώζω αυτούς
13. Re- δημιουργώ the βάζο αρχείο
Ιανουάριοs 16th, 2005 σε 248: είμαι
γεια εγώ ακολούθησα όλος the βήματα με κανένα πρόβλημα. The μόνο διαφορά was σε σκαλί 11 (” εκχύλισμα php5srvlt.jar και εκχύλισμα/unjar ( βάζο xvf β¦) αυτό κάτω c:”). εκχύλισμα από που? εγώ υποθέτω αυτού’ τοποθέτησα μέσα PECL zip αρχείο. εκεί was μόνο “phpsrvlt.jar” so εγώ μεταχειρισμένος ότι αντί. τα πάντα else was εξαιρετικός.
τώρα σκαλί 19: επάνω σε πρώτος σελίδα αίτηση από το βόσκω εγώ αποκτώ επόμενος error:
java.lang.IllegalAccessError: προσπάθησα σε προσέγγιση μεθανόλη net.php.reflect.loadLibraryLjava(/ γλώσσα/ κορδόνι;) από τάξη net.php.servlet
net.php.servlet.initservlet.java157(:)
[snipped]
…μέρα παρά μέρα σελίδα αίτηση αποτέλεσμα σε αυτό error:
java.lang.UnsatisfiedLinkError: στέλνω
net.php.servlet.sendNative( μεθανόλη)
net.php.servlet.serviceservlet.java190(:)
net.php.servlet.serviceservlet.java214(:)
javax.servlet.http.HttpServlet.serviceHttpServlet.java802(:)
Im’ όμορφος σίγουρος εγώ έκανα όλος δικό σου βήματα, so πού θα μπορούσεs να είμαι the πρόβλημα?! Im’ χρησιμοποιώνταs Tomcat 5.5.4 και PHP 5.0.3…
ευχαριστώ μέσα προωθώ για δικό σου βοήθεια.
Ιανουάριοs 16th, 2005 σε 408: είμαι
Lukas> The μόνο διαφορά was σε σκαλί 11 (” εκχύλισμα php5srvlt.jar και εκχύλισμα/unjar ( βάζο xvf β¦) αυτό κάτω c:”). εκχύλισμα από που? εγώ υποθέτω itβs τοποθέτησα μέσα PECL zip αρχείο. εκεί was μόνο βphpsrvlt.jarβ so εγώ μεταχειρισμένος ότι αντί. τα πάντα else was εξαιρετικός.
Angsuman> εγώ εννόησα εκχύλισμα the περιεχόμενα του phpsrvlt.jar. The ιδέα is σε αλλάζω the περιεχόμενα του δύο ιδιοκτησία, περιουσία αρχείο με the βάζο αρχείο. και ναι εσύ θα αποκτώ the βάζο αρχείο μέσα pecl.zip.
LukasNow> σκαλί 19: επάνω σε πρώτος σελίδα αίτηση από το βόσκω εγώ αποκτώ επόμενος error
Angsuman> παρακαλώ φτιάχνω the αλλάζω και πεs μου εάν you ακόμα πρόσωπο the πρόβλημα.
Ιανουάριοs 18th, 2005 σε 415: pm
γεια Im’ χρησιμοποιώνταs Tomcat 5.5.4 με PHP 5.03. Ive’ ακολούθησα όλος the instuctions επάνω και πήρα σε σκαλί 19. πότε εγώ πηγαίνω στοhttp:/localhost8080:/fun/test.php/ εγώ αποκτώ έναs κενό οθόνη. πότε εγώ στρέφω το βλέμμα μου σε the πηγή, αυτό περιέχω αυτό εμφανίζομαι ότι Tomcat is φόρτωση the test.php αρχείο μα the php script is όχι running. Ive’ προσπάθησα this με και χωρίs the επιπλέον διάστημα μέσα reflect.properties και servlet.properties and get the same behavior. Thanks for your help!
January 18th, 2005 at 4:33 pm
Hi. That last message was supposed to say “it contains phpinfo();” but the website didn’t like the LT/GT ?
January 23rd, 2005 at 4:23 am
Finally got it working! The problem was in my classpath setup. I got two different php_java.jar files accessible through classpath and Java was all confused with it (that’s why I was still getting this java.lang.IllegalAccessError)…
Now I’m wondering if there’s a way to call Java code within the servlet’s JVM from the actual PHP code. To be more specific: I need to create Java singleton in PHP code and share this singleton within all server PHP-requests (I tried PHP Java integration using PHP object Java [ie. ] but PHP interpretter was starting extra JVM for each single page it interpretted). Any ideas? Thanks…
January 23rd, 2005 at 3:54 pm
Lukas> Now Iβm wondering if thereβs a way to call Java code within the servletβs JVM from the actual PHP code. To be more specific: I need to create Java singleton in PHP code and share this singleton within all server PHP-requests (I tried PHP Java integration using PHP object Java [ie. ] but PHP interpretter was starting extra JVM for each single page it interpretted). Any ideas? Thanksβ¦
There is a simple way and there is a complicated way
The simple way would be to write a jsp page which contains the desired code and load the page from php code.
January 23rd, 2005 at 3:55 pm
Brian> Hi. Iβm using Tomcat 5.5.4 with PHP 5.03. Iβve followed all the instuctions above and got to step 19. When I go to http:/localhost:8080/fun/test.php/ I get a blank screen. When I look at the source, it contains It appears that Tomcat is loading the test.php file but the php script is not running. Iβve tried this with and without the extra spaces in reflect.properties and servlet.properties and get the same behavior. Thanks for your help!
Brian,
I think you missed step 10. That creates the mapping between .php file and the servlet.
Please check and let me know.
January 24th, 2005 at 12:39 am
Angsuman> I tried repeating step 10 again, assuming I made a mistake, but was still unable to get this to work. Is the php5srvlt.jar supposed to be in the C:/php directory as well, or just the WEB-INF/lib? When I recreate the jar, does it suffice to edit the reflect.properties and servlet.properties files and overwrite the files in the jar or do I need to use the java command to rebuild the jar???
This is what my directory structure looks like:
webapps/fun/
test.php
WEB-INF/
lib
web.xml
php5srvlt.jar
Thanks again!
January 24th, 2005 at 1:36 am
Brian> I tried repeating step 10 again, assuming I made a mistake, but was still unable to get this to work.
Angsuman> Any errors in tomcat log files?
Brian> Is the php5srvlt.jar supposed to be in the C:/php directory as well, or just the WEB-INF/lib?
Angsuman> Just WEB-INF/lib should be fine.
Brian> When I recreate the jar, does it suffice to edit the reflect.properties and servlet.properties files and overwrite the files in the jar or do I need to use the java command to rebuild the jar???
Angsuman> I am not sure I understand. You need to unjar the files, modify them and then rebuild the jar and deploy the new jar file. Verify it by checking that the files have actually been changed and that the path information of the files is identical to the original. The steps given, if followed to the dot should ensure that.
Brian> This is what my directory structure looks like:
webapps/fun/
test.php
WEB-INF/
lib
web.xml
php5srvlt.jar
Angsuman> The directory structure is not clear from this comment. The php file should be under fun. WEB-INF/web.xml, WEB-INF/lib/*.jar should be the normal order of files.
Specifically web.xml should be under WEB-INF directory and not under lib.
Hope that clarifies…
January 24th, 2005 at 3:47 pm
Well, I have a weird problem. Everything is set up, but I get this exception about gibberish:
java.io.IOException: Β°?ΓΌΒ°?ΓΌΒΈ?ΓΌΒ€CΓΌΓΌ>β
at net.php.servlet.send(Native Method)
at net.php.servlet.service(servlet.java:190)
[snipped]
Do let me know if you have any information on this.
Thanks,
Sachin
January 24th, 2005 at 4:15 pm
Sorry for a hasty post previously, that problem is solved. I do have another problem, but I haven’t started working on solving it yet. Its about a fairly complex php page not displaying properly. Will post more on that in case I can’t solve it. Once again, sorry for the big (and useless) post above.
Thanks,
Sachin
January 24th, 2005 at 4:20 pm
No problem! Let me know how it gies Sachin. Do share if you have found something new.
January 24th, 2005 at 11:57 pm
I am receiving a similar error to what Sachin was getting and was wondering what the solution to that was? The first time I try to lead the page I am getting this error:
javax.servlet.ServletException: Servlet.init() for servlet php threw exception
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
[snipped]
root cause
java.lang.UnsatisfiedLinkError: no php5srvlt in java.library.path
java.lang.ClassLoader.loadLibrary(Unknown Source)
[snipped]
When I reload the page I get this error:
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:802)
Thanks for the help!
January 25th, 2005 at 2:20 pm
Brian,
Is php5srvlt.jar file under WEB-INF\lib directory?
Please restart tomcat and let me know if the problem persists.
Angsuman
January 25th, 2005 at 2:30 pm
BTW: Made a small update to the post to clarify that web.xml should be placed under WEB-INF directory. I previously assumed everyone knows that due to previous experience with servlets.
January 25th, 2005 at 7:14 pm
sorry…. nooobie here, How to Rebuild jar file ?
January 25th, 2005 at 7:53 pm
ok to unjar > “jar xfv phpsrvlt.jar”
to Recreate the jar file > “jar cvf php5srvlt.jar net/php/*.*
done this and pasted the newly created jar file into c:\php and fun\WEB-INF
but apparently my Tomcat root seems to be the webapps\ROOT folder, n not just Webapps.. so I pasted my ‘fun’ inside this ROOT folder…
k but still gettin a blank page
January 25th, 2005 at 7:58 pm
oh.. and one more thing… my root already seems to have a WEB-INF with a lib n web.xml within it…
this doesn affect anything rite ?
January 25th, 2005 at 11:30 pm
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:105)
[snipped]
root cause
java.lang.UnsatisfiedLinkError: no php5servlet in java.library.path
java.lang.ClassLoader.loadLibrary(Unknown Source)
[snipped]
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.4 logs.
——————————————————————————–
Apache Tomcat/5.5.4
January 25th, 2005 at 11:31 pm
hmmm “webapps” seems to be the root now… haha
and the ‘php5srvlt.jar’ is inside the tomcat ‘C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\run\WEB-INF\lib’ folder..
but still gettin the same error as Brain…. as stated in the above previous post..
January 26th, 2005 at 12:49 am
Nikhli,
Please read the tomcat documentation.
To create a web app you can either use ROOT (not advisable) or create a directory with any name and create certain directories like WEB-INF under it. Also create a web.xml under WEB-INF.
January 26th, 2005 at 4:57 am
Hi angsuman,
yup, did that, but still the error
January 26th, 2005 at 2:30 pm
hi Nikhil, all –
I have the answer to your problem, which I was encountering also. Just got this working after about an hour of banging on it.
The problem is that the reflect.properties and servlet.properties files that we are modifying inside the jar actually point to the DLL file….so the line MUST read
library=php5servlet
Because the instructions above are unclear, we were all confused about the difference between the names php5srvlt and php5servlet.
In reality, the name of the jar file (phpsrvlt.jar) is irrelevant, since Tomcat will automatically load ANY jar file in the apps WEB-INF/lib directory.
Through some magic that I don’t understand, the library=php5servlet line tells the classes in the Jar file to call out to the native environment and load the native DLL of the same name (which is why it must be on the PATH)
Hope this helps post your response.
tx
Jason
January 27th, 2005 at 7:04 pm
Thanks Jason for the tip. I didn’t realize that people were making the incorrect assumption between the dll file name and the jar file name. I have updated the document to clarify this.
> Through some magic that I donβt understand, the library=php5servlet line tells the classes in the Jar file to call out to the native environment and load the native DLL of the same name (which is why it must be on the PATH)
No magic here. Just a simple loadLibrary call to load the native dll. JNI is used here for communicating with the php processor.
January 28th, 2005 at 6:24 am
I am getting this error repeatedly no matter what I do to resolve it..:(
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:105)
[snipped]
root cause
java.lang.UnsatisfiedLinkError: no php5servlet in java.library.path
java.lang.ClassLoader.loadLibrary(ClassLoader.java:1517)
[snipped]
If I reload the page, it would be
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:802)
I have gone through all the suggestions above and I still could not find where the problem is..can any one help me?
Thanks,
Mallika
January 28th, 2005 at 9:40 am
Hi,
getting PHP to work in Tomcat is exactly what I need. So the above instructions are awsome. But has anybody actually got it to run yet?
And do you know if the same instructions should work on other platforms such as Unix or Mac OS X. Or if not do you know how to get it to work on other platforms?
Thanks,
Meike
January 28th, 2005 at 2:33 pm
Meiki, I received email from a number of people who were successful in running it. See the comments above also.
Mallika,
> java.lang.UnsatisfiedLinkError: no php5servlet in java.library.path
Ensure that the name of the dll file is the same name that you specified in both the properties file in the jar which you have modified. Please check the instructions again which I have updated to clarify the above issue. Also see the comments by Jason above.
Hope that helps…
February 1st, 2005 at 2:59 am
I got it, finally. I was doing mistake in recreating jar file after the changes were made to the .properties files. Thanks anyways, Angsuman. Your article is indeed very helpful.
- Mallika
February 5th, 2005 at 9:36 am
So I managed to get PHP running on Tomcat 5.5, but im not getting a querky error. After banging on my webserver for only a minute or two, tomcat seems to be crashing and the webpage will display the following error:
Proxy Error
The proxy server received an invalid response from an upstream server.
The proxy server could not handle the request GET index.php.
Reason: Error reading from remote server
Has anyone else encountered this error and does anyone have any ideas on how to troubleshoot it? I’ve checked the Tomcat 5.5 logs and they appear to be ok. After getting this error I have to restart Tomcat to bring it back up again. Any help would me most appreciated. Thanks!
February 5th, 2005 at 10:30 pm
This error happens when a proxy server is accessed like a normal web server. This has nothing to do with php installation AFAIK.
Are you accessing the actual tomcat page os are you accessing a proxy server URL instead? Check your port. Tomcat by default runs on 8080. Do you have a proxy server running on your machine?
February 6th, 2005 at 3:49 am
There is no proxy proxy running, and the webserver is running on 8080. the weird thing is that i can view my webpage going back and forth from different pages, and it works fine. Then for some reason, i click on a link which i already verified, and it gives me the error message i previously posted. I’ve done this over and over again, and it seems random where the errors are occuring. Sometimes it on one link, other times it’s on others. I tried this using the jsp pages included in the installation and was unable to reproduce the error, thus why i’m concluding that it must be a problem with the PHP installation. Has anyone else tried doing this installation on Tomcat 5.5.4 using JDK 5.0???
February 6th, 2005 at 6:13 am
So I’ve investigated more and discovered that the proxy error is from my parent server but only because my server is being crashed. I’ve run the same test on my local machine and recieved the following error:
The connection was refused when attempting to contact localhost:8080
This appears to be only because the server is down, and doesn’t seem to help much with troubleshooting. But for some reason, on random requests, like i stated in my previous post, the server is being crashed. Any ideas?
Thanks again!
February 6th, 2005 at 6:20 am
Also, I’ve noticed that php only works when i put the php5srvlt.jar in the common/lib directory and it will not work in the webapps/www/lib directory.
webapps/www is where my website is located
February 6th, 2005 at 3:22 pm
Brian,
I haven’t faced any server crashing issue. The php5srvlt.jar can be in common.lib. It can also be in www/WEb-INF/lib directory where www is your webapps directory. The second way (as mentioned in the post above) is useful for people who use a shared tomcat instance as provided by their hosting provider. Also it allows you to limit the capability to one web application only.
February 8th, 2005 at 10:00 pm
Hallo,
what is meant with Point 15 (add c:php …). I opend SystemEnvironment and added a new systemVariable: name=php and value= c:\php. Is this correct? I ask because I get an error message wehn trying to load the test.php and maybe this is the reason.
Greets
Error Message:
…
root cause
java.lang.UnsatisfiedLinkError: send
at net.php.servlet.send(Native Method)
at net.php.servlet.service(servlet.java:190
…
kai
February 8th, 2005 at 10:09 pm
Kai,
Thanks for pointing out the error of missing backward-slash, It happened when I recently edited the post to add some clarifications. In the process I forgot that the post contains some backword-slashes. Now my blog software unfortunately eats away one backward-slash everytime I edit a post. So I have to manually replace each single backward-slash with double. Unfortunately I forgot to do that in this instance. Thanks again for pointing it out.
Let us know how it goes.
February 8th, 2005 at 10:48 pm
So, if this is not the error, I don’t know what’s wrong. I copied php5servlet.dll into c:/php. Than I created the directories and modified the two files. My directory Structure is:
webapps/fun –> test.php, WEB-INF
WEB-INF –> lib, web.xml
lib –> php5srvlt.jar
But after restarting Tomcat I get the the following error message. And when I reload the website I get the same message with a different root cause.
I read the posts about this problem, but none of the solutions woked for me.
1. Exception
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
…
[snipped]
2. Exception
…
root cause
java.lang.UnsatisfiedLinkError: send
at net.php.servlet.send(Native Method)
at net.php.servlet.service(servlet.java:190)
[snipped]
February 9th, 2005 at 2:07 am
Kai,
Read the comment by Jason above. This problem happens due to improper specification of the location of php5servlet.dll in the properties file.
Please check the comments above as others have also faced and solved the same issue.
February 9th, 2005 at 7:15 pm
IMPORTANT: Everybody with an unsatisfied link error double check that you do not have an extra whitespace in the properties files that you change. Servlet.properties and Reflect.properties both have extraneous whitespaces after the names of the dlls.
Thanks for the great HOW-TO!
February 9th, 2005 at 9:22 pm
Hi,
I read the comments. Also the one of Jason. But still the same error message. Maybe I do something wrong when extracting the phpsrvlt.jar. I’ve opened the file with winrar, made the changes and saved the file without extracting it.
February 10th, 2005 at 2:14 am
HI,
ich have the same problem like Sachin , how can i solve it?
2005-02-10 14:51:16,622 [http-8080-Processor25] WARN StandardWrapper[/ikarus_prototype:php] Servlet.service() for servlet php threw exception
java.io.IOException: ?l ?l l ?l
at net.php.servlet.send(Native Method)
[snipped]
10.02.2005 15:00:54 org.apache.coyote.http11.Http11Protocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
10.02.2005 15:00:55 org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0×0c08f185, pid=1640, tid=1912
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_01-b08 mixed mode)
# Problematic frame:
# C [php5ts.dll+0x3f185]
#
# An error report file with more information is saved as hs_err_pid1640.log
#
# If you would like to submit a bug report, please visit:
# http:/java.sun.com/webapps/bugreport/crash.jsp/
#
February 10th, 2005 at 2:45 am
Kai,
Check the jar file again to see if the changes are properly saved. Check the pointer by ez.
EZ,
Thanks for the pointer.
Dennis,
One simple thought. Please restart the server and see if the error persists. Have you checked the suggestions and hints in the comments section by numerous readers?
February 10th, 2005 at 7:32 pm
Thanks Angsuman, it’s works.
Don’t know why
Yesterday i’ve restarted Tomc@ and Windows several times but without an effect. (got an unexpected error caused by php5servlet.dll)
But today… hmmmm it’s works! : \
Are you running your Tomc@ as a service?
What about JavaVM 1.5 or 1.4?
February 14th, 2005 at 4:11 pm
I’m also still getting the UnsatisfiedError after checking the *.properties files several times in notepad. also $PATH includes as I can run the command “php” from anywhere. But when trying that I encountered the following error:
PHP Startup: Unable to load dynamic library ‘./php_java.dll’ The specified module could not be found.
which is true as far as i know as there is no such file in c:\php, but when browsing through the files a found a php_java.jar in c:\php\ext. does anyone know what is wrong in my configuration?
Thank you for this tutorial, i appreciate it
felix
February 14th, 2005 at 4:33 pm
Felix,
Check the PECL modules (instruction 2) you have downloaded.
Thanks for the compliment.
Angsuman
February 14th, 2005 at 4:52 pm
Works beautifully
Thank you again!
felix
February 16th, 2005 at 7:05 pm
To start off, i have read through each and every post on this thread… Still getting the following error when attempting to load my test.php page.
Feb 16, 2005 11:31:45 PM org.apache.catalina.core.StandardWrapperValve invoke
WARNING: Servlet.service() for servlet php threw exception
java.io.IOException: `R,`R,hR,TV,?
at net.php.servlet.send(Native Method)
[snipped]
I noticed Sachin had this problem, and resolved it somehow …? Any help would be most appreciated.
February 16th, 2005 at 10:15 pm
One simple thought. Please restart the server and see if the error persists.
February 17th, 2005 at 1:16 am
I followed the steps but…
javax.servlet.ServletException: Wrapper cannot find servlet class net.php.servlet or a class it depends on
[snipped]
root cause
java.lang.ClassNotFoundException: net.php.servlet
[snipped]
what should i do????
February 17th, 2005 at 2:06 am
Hi Angsuman,
Your tutorial has been a great help.
but i still have the
java.lang.UnsatisfiedLinkError: no php5servlet in java.library.path
error.
i have read all the comments above and done the necessary changes.
when i recreate the jar (jar cvf php5srvlt.jar net/php/*.* ) the class files are not getting created (servlet.class, reflect.class) which were there before. what should i do?
any help would be really appreciated.
thanks a lot
Meera.
February 17th, 2005 at 2:11 am
Hi,
i want to use the SAPI module in php to make a servlet running in tomcat handle a php request.
any pointers about how to go about this would be really helpful.
thanks a lot.
Meera.
February 17th, 2005 at 3:50 am
Guto,
Check to see the jar file is under the WEB-INF\lib directory as required.
Meera,
Looks like you are not creating the jar file properly with changes. Please follow the steps exactly. Also please check my comment on 1/2/2005 on the same topic.
February 17th, 2005 at 4:50 pm
First of all, thanks Angsuman for the tutorial and also the people that have replied with tips. ^_^
I had that “java.lang.UnsatisfiedLinkError: send” error for a while and the solution was simply to completely restart the tomcat server.
Now it works fine but every time I go to localhost:8080/fun I can see the index.php as if it didn’t auto-recognize the file! Anyone has any idea how to fix this?
Note: I know to fix this on an Apache server you would do something like “DirectoryIndex index.html index.html.var index.php ” but for Tomcat I have no clue.
thanks.
Dlfiles
February 17th, 2005 at 8:42 pm
hi,
Thanks for tip. I no longer have the UnsatisfiedLinkError.
But this is the error i get when i try to run any php program inside the fun directory. If i place a php file in the root directory, it is not getting parsed. ( the dialog box offering to save or open the file appears)
java.io.IOException: ΒΈ2Bm
at net.php.servlet.send(Native Method)
[snipped]
thanks,
Meera.
February 18th, 2005 at 4:49 am
Meera,
As DlFiles mentioned before you:
February 18th, 2005 at 5:13 am
Dlfiles,
Add the following at the end of the web.xml of your web application, before the </web-app> tag.
<welcome-file-list>
<welcome-file>index.php</welcome-file>
</welcome-file-list>
You can similarly use other extensions too. The default extensions are jsp, htm and html, defined in conf/web.xml.
February 18th, 2005 at 10:32 am
Angsuman,
Everything is working fine now! thanks again!
March 6th, 2005 at 2:04 am
FYI, I just tried using the web.xml you have listed above and the servlet did load. I removed the DOCTYPE line and it worked. I think you may have something wrong with your slashes possibly. However, the doctype isn’t required.
P.S. thanks for all the help, your tutorial is excellent!
March 6th, 2005 at 2:41 am
So i’ve reinstalled everything and I’m getting random errors killing the Tomcat server still. in my system32 folder there is a log which is printing out the following… any ideas??? it looks like there is an error in php5ts.dll.
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0×0583eced, pid=832, tid=3472
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_01-b08 mixed mode, sharing)
# Problematic frame:
# C [php5ts.dll+0x3eced]
#
————— T H R E A D —————
Current thread (0×032b1438): JavaThread “http-8080-Processor25″ daemon [_thread_in_native, id=3472]
siginfo: ExceptionCode=0xc0000005, reading address 0×00000016
Registers:
EAX=0×035c5668, EBX=0×00000002, ECX=0×00000002, EDX=0×00000007
ESP=0×051fef64, EBP=0×77c2c21b, ESI=0×05c1c6c8, EDI=0×035c5668
EIP=0×0583eced, EFLAGS=0×00010297
Top of Stack: (sp=0×051fef64)
0×051fef64: 05c1c6c8 051ff120 032b3998 0585fe90
0×051fef74: 00000002 05c1c6fc 0583b7dd 05c1c6c8
0×051fef84: 05c1c6f0 0583ee74 05c1c6fc 051ff118
0×051fef94: 035c5668 051ff120 032b3998 0583ef43
0×051fefa4: 035c5668 05c1c6f0 035c56f8 0583b039
0×051fefb4: 035c5668 035c57f4 032b3998 05b48660
0×051fefc4: 0583b5f0 032b3998 035c56f8 051ff1f8
0×051fefd4: 032b3998 032b1438 032b1438 00000006
Instructions: (pc=0×0583eced)
0×0583ecdd: 90 90 90 53 8b 5c 24 08 55 8b 2d 18 a2 9f 05 56
0×0583eced: 8b 73 14 85 f6 74 51 57 8b 43 20 8b fe 8b 76 10
Stack: [0x05100000,0x05200000), sp=0x051fef64, free space=1019k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [php5ts.dll+0x3eced]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j [Truncated]
March 6th, 2005 at 2:44 am
So I’ve reinstalled everything and I’m still getting the same problems where after clicking a bunch of links on my page, my Tomcat server crashes. there is an error log in my system32 folder that is printing out the following. it looks like there is an error in php5ts.dll… and ideas???
#
# An unexpected error has been detected by HotSpot Virtual Machine:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0×0583eced, pid=832, tid=3472
#
# Java VM: Java HotSpot(TM) Client VM (1.5.0_01-b08 mixed mode, sharing)
# Problematic frame:
# C [php5ts.dll+0x3eced]
#
————— T H R E A D —————
Current thread (0×032b1438): JavaThread “http-8080-Processor25″ daemon [_thread_in_native, id=3472]
siginfo: ExceptionCode=0xc0000005, reading address 0×00000016
Registers:
EAX=0×035c5668, EBX=0×00000002, ECX=0×00000002, EDX=0×00000007
ESP=0×051fef64, EBP=0×77c2c21b, ESI=0×05c1c6c8, EDI=0×035c5668
EIP=0×0583eced, EFLAGS=0×00010297
[snipped]
March 6th, 2005 at 2:45 am
im having trouble posting to your site maybe my post is too long… im trying to include an error log message
March 17th, 2005 at 8:44 pm
Brian,
Sorry for the delay in responding. The comments were getting gobbled up by a defective filter in WordPress 1.5 ( more on it soon ). I am looking at your problem now.
March 17th, 2005 at 8:53 pm
Brian> I think you may have something wrong with your slashes possibly. However, the doctype isnβt required.
You are correct. WordPress 1.5 messed up the double-quotes. I have removed them now. Thanks for the information.
March 17th, 2005 at 8:55 pm
@Brian Why is php5ts.dll in your path? I don’t remember seeing that.
March 18th, 2005 at 8:25 am
Your tutorial was of great help in getting php connected, but only seems to work for the first php applicaiton that I hit on my web server.
For instance if I copy webapps\fun to webapps\fun2 and restart Tomcat (4.0.6) and then access either of them, it works. But when I access the other one I get an error message:
java.lang.UnsatisfiedLinkError: Native Library C:\php\php5servlet.dll already loaded in another classloader
I tried moving the jar file into the common\lib and modifying the web.xml in the conf directory to include the servlet ans servlet-mapping directives, but can’t seem to find the right twist for it.
Starting service Tomcat-Standalone
/Apache Tomcat/4.0.6
ERROR reading java.io.ByteArrayInputStream@161dfb5
At Line 11 web-app/servlet/
Starting service Tomcat-Apache
Apache Tomcat/4.0.6
March 18th, 2005 at 8:56 am
Ah, “already loaded in another classloader” problem solved.
Move the php5srvlt.jar file out of the tomcat directory and put it in the Java jre/lib/ext directory
(C:\Java\j2sdk1.4.2_07\jre\lib\ext on my PC)