Professional Documents
Culture Documents
Este Blog trata de aspectos del rea del Software, Sistemas, Hardware o Electrnica
Saltar al contenido.
Inicio
About
Obtaining Size or Dimension of Images
Manually Installing Php, Tomcat and Httpd Lounge
2 Votes
Maybe this post is rare for someone, but I will try to explain how to
install PHP working with Tomcat.
This tutorial was tested using Windows 7 of 32 bits.
PHP can works with the library named PECL, the last library that help us to
reach the goal is the version 5.2.5.
The PECL 5.2.5 library contains .dll and .jar files that allow us to configure
some (not all) PHP version with Tomcat.
All instalation will be made in the folder:
C:\ServerWeb\
PHP
The last version of PHP that works with that PECL version was the 5.2.16. Then
I will use the PHP 5.2.16 for Win32.
The contents of the .zip file was uncompressed in the folder:
C:\ServerWeb\Php_5.2.16\
Inside of this folder there are two files containing templates of configuration of
php:
php.ini-dist (for developing) and php.ini-recommended (for production),
the difference consist into if the errors will be shown, while the version for
developing shows the errors and other information, the version for production
does not.
As Im testing I took php.ini-dist and copied:
copyphp.inidistphp.ini
Here we select the PATH variable and press the Edit button.
Finally modify the variable value adding at the end the path of PHP and press
the OKbutton.
Tomcat
The version of Tomcat tested that worked well was the 7.0.41, because 7.0.42
version had problems with starting and stopping in Windows. Then this post
will work with Tomcat 7.0.41 for Win32.
The contents of the .zip file was uncompressed in the folder:
C:\ServerWeb\Tomcat_7.0.41\
In the New System Variable dialog box, we write the name of the variable
withJAVA_HOME and the variable value with the path of Java, in my case
C:\Program Files\Java\jdk1.7.0_45\
Now we will make some changes optional on some files in the subdirectory
named bininside the folder of Tomcat.
To start Tomcat silently (without console window popup), change in the file
namedsetclasspath.bat, the line set _RUNJAVA
set_RUNJAVA="%JRE_HOME%\bin\javaw"
setPR_DESCRIPTION=Tomcat7.0.41Server
We can modify our web server port, which is initially set to 8080, change it
to 80, in this case we need to make changes in the file server.xml in the
You can also set the directory where all web applications will be deployed, for
this demostration, I made a new folder named Webapps located inside
of ServerWeb.
C:\ServerWeb\Webapps\
Inside of this folder, I made other folder named http, specifically a context that
represents an application.
C:\ServerWeb\Webapps\http\
And remove:
service.batremove
IntegratingTomcatwithPHP
This changes are in order to use PHP with Tomcat.
Download the PHP Extension Community Library version 5.2.5 for Win32.
For this example, I will unpack the contents to (although this is not necessary):
C:\ServerWeb\Pecl_5.2.5\
Second, as can be seen, two folders are decompressed one call net, inside which
there is another folder named php. In this folder php there are multifle files,
including one calledreflect.properties and another
called servlet.properties. The contents of both files must be:
library=php5servlet
Second change: including the mapping of the servlets and classes declared
before.
<!ThemappingsforthePHPservlet>
<servletmapping>
<servletname>php</servletname>
<urlpattern>*.php</urlpattern>
</servletmapping>
<servletmapping>
<servletname>phpformatter</servletname>
<urlpattern>*.phps</urlpattern>
</servletmapping>
Third change: including and establishing the files and its order in which the
default servlet looks for the "welcome file".
<welcomefile>index.php</welcomefile>
Last we will test the integration, creating a file named test.php inside of
C:\ServerWeb\Webapps\http\, the content is:
<?
phpinfo();
?>