HP 5991-5565 manual Integrating the Apache Web Server and PHP, # rpm -q php5 apache2-modphp5

Page 29

/var/log/apache2/error_log /var/log/apache2/access_log /var/log/apache2/mod_jk.log

Integrating the Apache Web Server and PHP

The Apache Web server that is shipped with the supported Linux distribution includes a built-in PHP module. Therefore, no extra configuration is required for Apache. Use the following procedure to configure PHP:

1.Verify that PHP is installed by entering the following command:

# rpm -q php5 apache2-mod_php5

2.Create the following test file:

/srv/www/htdocs/test.php

Add the following lines to the preceding file:

<?

## test.php phpinfo(); ?>

3.Verify that PHP works by opening a browser and navigating to the following website : http://<YOUR_HOSTNAME>/test.php

A web page containing the PHP version and license numbers is displayed.

Integrating the Apache Web Server and Perl

The apache2–mod_perlmodule integrates a Perl interpreter into the Apache Web server, allowing you to use Perl when creating web applications. Use the apache2–mod_perlmodule provided by the Linux distribution.

To test the installation, perform the following steps:

1.Verify that the apache2–mod_perlmodule is installed by entering the following command:

#rpm -q php5 apache2-mod_php5

2.Create a sample file test file named /srv/www/cgi-bin/test.pland add the following lines:

#!/usr/bin/perl

print "Content-type: text/plain\n\n"; print "Hello World!\n";

3.Assign execute permissions to the file by entering the following command:

#chmod +x /srv/www/cgi-bin/test.pl

4.Edit the /etc/sysconfig/apache2 file by adding perl to the line with APACHE_MODULES. After completing this edit, the line should look like the following:

APACHE_MODULES=”... ... perl”

5.Restart Apache by entering the following command:

#/etc/init.d/apache2 restart

If there are any errors, check the following log files:

/var/log/apache2/error_log /var/log/apache2/access_log

Installing, Configuring, and Managing Web Server Middleware Stack Components 29

Image 29
Contents HP Open Source Middleware Stacks Blueprint Copyright 2007 Hewlett-Packard Development Company, L.P Table of Contents Monitor Tomcat with OpenView Tomcat SPI Oracle Database Test Webalizer Usage ReportPage List of Tables Page Introduction HP ServicesExecutive Summary Intended AudienceHP Encourages Your Comments Typographic ConventionsUserInput Feedback@fc.hp.comWeb Server Stack Architecture HP Open Source Web Server Middleware StackWeb Server Stack Architecture Required Packages and Installation Recommendations Installing and Verifying the Linux DistributionInstalling the Linux Distribution YaST Software Selection and System Tasks Verifying the Linux Distribution InstallationInstalling and Configuring Sun JDK on an HP Proliant System Configuring the Basic Apache Http ServerTomcat # /etc/init.d/apache2 startFor the alljava.csh file, add the following lines # ln -s /usr/java/jdk1.5.010 /usr/local/jdkFor the alljava.sh file, add the following lines # java -version Installing and Configuring TomcatFollowing messages appear # /usr/local/apache-tomcat/bin/startup.shUsing the Apache Http Server Benchmarking Tool Advanced Apache Http Server FeaturesIf necessary, stop Tomcat by entering the following command # /usr/local/apache-tomcat/bin/shutdown.shApache Http Server Status and Information You can correct the error by entering the followingApachemodules definition should now look like the following Restart the Apache Http Server for the changes take effectApache Server Information web page opens, as shown in Figure Apache Server Status web page opens, as shown in Figure# webalizer Apache Http Server Log# /etc/init.d/apache2 restart Create the following file Using Virtual Host SupportFor detailed information, see the Webalizer website at On the second server, create the following Html file Using Apache Http Server URL RedirectionConfigure virtual hosting by creating a file named Edit the following configuration file Using Apache Http Server Proxy FeaturesAdd the following line to the preceding file Add the following lines to the preceding fileCreate the following Html file Error Responses and RedirectsPopulate the preceding file with the following lines Using Per-User Web DirectoriesIntegrating the Web Server Stack Components Configuring the Apache and Tomcat ConnectorIf there are any errors, check the following log files Restart Apache by entering the following commandInsert the following line below the DocumentRoot line Http//YOURHOSTNAME/jsp-examplesIntegrating the Apache Web Server and Perl Integrating the Apache Web Server and PHP# rpm -q php5 apache2-modphp5 Create the following test fileWeb page displays the following text Connecting Tomcat to a DatabaseIntegrating the Apache Web Server and Python # tar zxf mysql-connector-java-version.tar.gz Connecting Tomcat and MySQL# $CATALINAHOME/bin/startup.sh # mysqladmin -u root -p create osmsdb# ps -efgrep mysqld # /etc/init.d/mysql startIf needed, start Tomcat by entering the following command Connecting Tomcat and OracleHttp//YOURHOSTNAME8080/mysqltest.jsp Test page opens as shown in FigureConfiguring the Oracle Server Obtaining and Installing the Oracle Jdbc DriverTesting the Oracle Database Connectivity Creating an Oracle Data SourceOracle Database Test Http//YOURHOSTNAME8080/oracleTest.jspInstalling Hibernate, Tomcat, and JDK Connecting Tomcat to MySQL or Oracle Using HibernateConfiguring a Database Driver in Tomcat # mysql -u root -p Password# sqlplus osmsusr/osmspass@osmsdbora Creating a Simple Application in TomcatFor a MySQL database server For an Oracle database serverAsm.jar asm-attrs.jar antlr-2.7.6rc1.jar File HibernateSessionFactory.class is generated This directory, create a Hibernate Pojo file named Preceding command creates a class file namedHttp//YOURHOSTNAME8080/SimpleDemo/hibernate.jsp Verifying the Simple Application OperationRestart Apache by entering the following Secure the Web Server StackEnabling Https Support in the Apache Http Server Apache default document root is Apache Http Server AuthorizationVerify that the certificate is displayed as in Figure Create the following test Html fileIf the login fails, the following message appears Protecting Apache Http Server Authorization with Symas CDSConfiguring Apache Http Server Services Html Head Protecting Tomcat Authorization with Symas CDSHtml Head # $CATALINA/bin/shutdown.sh # $CATALINA/bin/startup.sh Monitor Tomcat with OpenView Tomcat SPITomcat SPI Components Software Prerequisites and Reference GuidesPolicies ToolsComplete these steps Complete these steps # /sbin/SuSEfirewall2 stop Appendix B Frequently Asked QuestionsAppendix C Vendor Information Reference Appendix D Hibernate Test Application Source Code Following are the contents of the hibernate.jsp filePage Appendix D Hibernate Test Application Source Code