What it solves: Ce qu'il résout:

  1. Using php 5.x on Tomcat 4.x or 5.x Utiliser PHP 5.x sur Tomcat 4.x ou 5.x
  2. Enabling php only in one web application, instead of globally. L'activation de php seulement dans une application Web, au lieu de l'échelle mondiale.


The simplest possible configuration is described. Le plus simple configuration possible est décrit. The descriptions are terse assuming your intelligence. Les descriptions sont laconique, en supposant que votre intelligence.

We will assume php will be installed in c:\ drive. Nous supposons que PHP est installé dans c: \. Substitute with drive letter of your choice. Remplacer par le lettre de lecteur de votre choix.

Instructions Instructions

  1. Download latest php 5.x zip file. Télécharger la dernière php 5.x fichier zip.
    I used J'ai utilisé http://www.php.net/get/php-5.0.2-Win32.zip/from/a/mirror .
  2. Download latest Collection of PECL modules. Télécharger la dernière Collection de modules PECL. I used J'ai utilisé http://www.php.net/get/pecl-5.0.2-Win32.zip/from/a/mirror .
  3. Unzip php 5.x zip file anywhere, normally c:\php Php 5.x Décompressez le fichier zip n'importe où, normalement c: \ php
  4. Copy php.ini-dist, in c:\php , as php.ini Copiez le fichier php.ini-dist, dans c: \ php, comme le php.ini
  5. Uncomment the line (remove semi-colon at the beginning) in php.ini: Décommentez la ligne (enlever point-virgule au début) dans le fichier php.ini:
    ;extension=php_java.dll ; extension = php_java.dll
  6. Extract php5servlet.dll from pecl zip file to c:\php (Uncheck "Use Folder Names" in WinZip). Extrait à partir de PECL php5servlet.dll fichier zip dans c: \ php (Désélectionnez l'option Utiliser les noms de dossiers "dans WinZip).
    Ensure that the file is actually present in c:\php Assurez-vous que le fichier est en fait présent dans c: \ php
  7. Install Tomcat and create a directory under webapps. Installez Tomcat et créer un répertoire dans webapps. Lets say it is named fun . Disons, il est nommé plaisir.
  8. Create WEB-INF directory under fun Créer WEB-INF répertoire dans fun
  9. Create lib directory under WEB-INF Créer un répertoire lib sous WEB-INF
  10. Create web.xml under WEB-INF with the following contents: Créer un fichier web.xml WEB-INF avec le contenu suivant:
     php PHP  net.php.servlet  php-formatter PHP-formateur  net.php.formatter  php PHP  *.php *. php  php-formatter PHP-formateur  *.phps *. phps 
  11. Extract php5srvlt.jar and extract/unjar (jar xvf …) it under c:\ Extrait php5srvlt.jar extrait et / unjar (jar xvf…) il sous c: \
  12. Modify both the files reflect.properties and servlet.properties to change the line library=phpsrvlt to library=php5servlet and save them. Modifier les fichiers reflect.properties servlet.properties et de changer la bibliothèque en ligne = phpsrvlt à la bibliothèque = php5servlet et les enregistrer. This indicates the file name of the dll file which is loaded by the Java application to serve the requests. Ceci indique le nom de fichier du fichier DLL qui est chargé par l'application Java de servir la demande. In my version the name of the dll was php5servlet.dll . Dans ma version le nom de la dll a été php5servlet.dll. Your mileage may vary. Votre kilométrage mai varier. This has no connection with the name of the jar file which can be anything. Cela n'a aucun lien avec le nom du fichier jar qui peut être n'importe quoi.
  13. Re-create the jar file Re-créer le fichier jar
  14. Copy the jar file to WEB-INF\lib directory created earlier Copiez le fichier jar de WEB-INF \ lib répertoire créé plus tôt
  15. Add c:\php to your System or User Path in Windows enironment (Hint: Right-click and select Properties from My Computer ) Ajouter c: \ php à votre système ou l'utilisateur sous Windows Sentier enironment (Remarque: Cliquez avec le bouton droit et sélectionnez Propriétés dans Poste de travail)
  16. Create a file test.php under fun with the following code: Créer un fichier test.php en vertu de plaisir avec le code suivant:

  17. Start Tomcat (Go to [Tomcat installation directory]\bin and type Tomcat). Début Tomcat (Aller à [répertoire d'installation Tomcat] \ bin et le type Tomcat).
  18. Open your browser and go to http://localhost:8080/fun/test.php Ouvrez votre navigateur et accédez à http://localhost:8080/fun/test.php
  19. Ensure that there are no errors displayed. Veiller à ce que les erreurs ne sont pas affichés. Instead you get an informative screen with php version information and whole lot of details Au lieu de vous obtenez un écran d'information avec les informations de version de php et beaucoup de détails

Let me know if this document is helpful to you. Permettez-moi de savoir si ce document est utile pour vous.

Update: Made minor revision to highlight some key elements. Mise à jour: Pris révision mineure de mettre en lumière certains éléments clés.

Solutions to common problems by users: Solutions à des problèmes communs par les utilisateurs:
Whoever is getting this error “java.lang.UnsatisfiedLinkError: no php5servlet in java.library.path”. Celui qui obtient cette erreur "java.lang.UnsatisfiedLinkError: aucun php5servlet dans java.library.path". Please check the two properties file, whether there are any blank spaces. S’il vous plaît vérifier les deux fichier de propriétés, s'il ya des espaces vierges. I was stuck in this problem for 2 days. J'étais coincé dans ce problème pour 2 jours. There should be only one line, and no blank spaces. Il devrait y avoir seulement une ligne, et pas des espaces. Check it now!!!. Jetez-y maintenant!. This is where the problem is lying. C'est là que le problème, c'est mentir.
–Arundhati - Arundhati

The versions of php and pecl must be the same. Les versions de PHP et pecl doit être la même.
–Mirek Mocek - Mirek Mocek

You might want to add a reboot step at the end of your instructions. Vous pourriez avoir besoin d'ajouter une étape redémarrage à la fin de vos instructions. It would eliminate a lot of the problems with the unsatisfied link errors. Il permettrait d'éliminer un grand nombre de problèmes avec le lien erreurs non satisfaits.
– Chuck Rosendahl -- Chuck Rosendahl

Note: Note:
If you find this tutorial useful, please consider donating and enjoy the pleasure of giving. Si vous trouvez ce didacticiel utile, s’il vous plaît envisager de don et apprécier le plaisir de donner.