What it solves: O que ela resolve:

  1. Using php 5.x on Tomcat 4.x or 5.x Usando o php 5.x em Tomcat 4.x ou 5.x
  2. Enabling php only in one web application, instead of globally. Ativando o php somente em uma aplicação web, em vez de globalmente.


The simplest possible configuration is described. A configuração é descrito mais simples possível. The descriptions are terse assuming your intelligence. As descrições são concisa assumindo a sua inteligência.

We will assume php will be installed in c:\ drive. Vamos supor php será instalado em c: \ drive. Substitute with drive letter of your choice. Suplente com letra de sua escolha.

Instructions Instruções

  1. Download latest php 5.x zip file. Download últimas php 5.x zip.
    I used Eu costumava http://www.php.net/get/php-5.0.2-Win32.zip/from/a/mirror .
  2. Download latest Collection of PECL modules. Download últimas Coleção de módulos PECL. I used Eu costumava 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 Descompacte o php 5.x zip em qualquer lugar, normalmente c: \ php
  4. Copy php.ini-dist, in c:\php , as php.ini Copiar php.ini-dist, em c: \ php, como php.ini
  5. Uncomment the line (remove semi-colon at the beginning) in php.ini: Descomentar a linha (remova ponto e vírgula no início) no php.ini:
    ;extension=php_java.dll ; extensão = php_java.dll
  6. Extract php5servlet.dll from pecl zip file to c:\php (Uncheck "Use Folder Names" in WinZip). Extrato de php5servlet.dll PECL arquivo zip para c: \ php (Desmarque "Usar As pastas" no WinZip).
    Ensure that the file is actually present in c:\php Verifique se o arquivo está realmente presente em c: \ php
  7. Install Tomcat and create a directory under webapps. Instale Tomcat e crie um diretório em webapps. Lets say it is named fun . Vamos dizer que é chamado diversão.
  8. Create WEB-INF directory under fun Criar diretório WEB-INF sob divertido
  9. Create lib directory under WEB-INF Criar diretório lib sob WEB-INF
  10. Create web.xml under WEB-INF with the following contents: Criar web.xml sob WEB-INF com o seguinte teor:
     php PHP  net.php.servlet  php-formatter PHP-formatter  net.php.formatter  php PHP  *.php php *.  php-formatter PHP-formatter  *.phps *. phps 
  11. Extract php5srvlt.jar and extract/unjar (jar xvf …) it under c:\ Extrato php5srvlt.jar e extrato / unjar (jar xvf…)-la sob c: \
  12. Modify both the files reflect.properties and servlet.properties to change the line library=phpsrvlt to library=php5servlet and save them. Modificar ambos os arquivos e reflect.properties servlet.properties para mudar de linha a biblioteca biblioteca phpsrvlt = = php5servlet e guardá-las. This indicates the file name of the dll file which is loaded by the Java application to serve the requests. Isso indica o nome do arquivo do arquivo dll que é carregado pela aplicação Java para atender os pedidos. In my version the name of the dll was php5servlet.dll . Na minha versão do nome do dll foi php5servlet.dll. Your mileage may vary. A sua duração pode variar. This has no connection with the name of the jar file which can be anything. Isso não tem nenhuma ligação com o nome do arquivo jar que pode ser qualquer coisa.
  13. Re-create the jar file Re-criar o arquivo jar
  14. Copy the jar file to WEB-INF\lib directory created earlier Copie o arquivo jar para WEB-INF \ lib diretório criado anteriormente
  15. Add c:\php to your System or User Path in Windows enironment (Hint: Right-click and select Properties from My Computer ) Adicionar c: \ php ao seu sistema ou usuário do Windows Caminho enironment (Dica: Clique com o botão direito e selecione Propriedades do Meu Computador)
  16. Create a file test.php under fun with the following code: Crie um arquivo test.php sob divertir com o código a seguir:

  17. Start Tomcat (Go to [Tomcat installation directory]\bin and type Tomcat). Inicie o Tomcat (Ir para o [Tomcat instalação diretório] \ bin e tipo Tomcat).
  18. Open your browser and go to http://localhost:8080/fun/test.php Abra seu browser e vá para a http://localhost:8080/fun/test.php
  19. Ensure that there are no errors displayed. Garantir que não haja erros exibidos. Instead you get an informative screen with php version information and whole lot of details Em vez que você começa uma tela com o php versão informativo informação e de todo lote de detalhes

Let me know if this document is helpful to you. Permitam-me saber se este documento seja útil para você.

Update: Made minor revision to highlight some key elements. Update: Made ligeira revisão para destacar alguns elementos fundamentais.

Solutions to common problems by users: Soluções para problemas comuns por usuários:
Whoever is getting this error “java.lang.UnsatisfiedLinkError: no php5servlet in java.library.path”. Quem está recebendo este erro "java.lang.UnsatisfiedLinkError: nenhum php5servlet em java.library.path". Please check the two properties file, whether there are any blank spaces. Verifique o arquivo duas propriedades, se existem espaços em branco. I was stuck in this problem for 2 days. Eu estava encalhado neste problema para 2 dias. There should be only one line, and no blank spaces. Não deveria haver apenas uma linha, e não há espaços em branco. Check it now!!!. Check-la agora!. This is where the problem is lying. É aqui que o problema está mentindo.
–Arundhati - Arundhati

The versions of php and pecl must be the same. As versões do php e PECL deve ser o mesmo.
–Mirek Mocek - Mirek Mocek

You might want to add a reboot step at the end of your instructions. Você pode querer adicionar um reboot etapa no final de suas instruções. It would eliminate a lot of the problems with the unsatisfied link errors. Seria uma grande quantidade de eliminar os problemas com a ligação insatisfeito erros.
– Chuck Rosendahl -- Chuck Rosendahl

Note: Nota:
If you find this tutorial useful, please consider donating and enjoy the pleasure of giving. Se você encontrar este tutorial útil, por favor, considere doar e desfrutar o prazer de dar.