• RSS
  • Twitter
  • FaceBook

Security Forums

Log in

FAQ | Usergroups | Profile | Register | RSS | Posting Guidelines | Recent Posts

How to Build, Install, Secure & Optimize PHP

Users browsing this topic:0 Security Fans, 0 Stealth Security Fans
Registered Security Fans: None
Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More

View previous topic :: View next topic  
Author Message
ComSec
Trusted SF Member
Trusted SF Member


Joined: 26 Jul 2002
Posts: 16777215


Offline

PostPosted: Sat Nov 30, 2002 6:47 pm    Post subject: How to Build, Install, Secure & Optimize PHP Reply with quote

How to Build, Install, Secure & Optimize PHP

Written by Gerhard Mourani <gmourani@openna.com>
Corrected by Colin Henry <Colin.Henry@ubsw.com>

This document is copyright(c) 2002 for Open Network Architecture Inc. (OpenNA) and it is a FREE document. You may redistribute it under the terms of the GFDL.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is available at http://www.gnu.org/copyleft/fdl.html.

Abstract

This document is a tutorial related to the Apache web server, you should read it only if you have installed Apache on your system and want to provide and make it run with some additional feature. Here we talk about PHP with Apache.

Everyone using a web server knows about PHP and its possibilities. It seems that PHP will certainly replace other language like Perl or CGI for web services in the future. This is due to its simplicity of use and many developers known about this and has already developed software that run with PHP on a web server. When you need to add some popular web service to your web server, you will inevitably find that PHP is required and that you need to install it with Apache. In this chapter we discuss about the way to integrate it with Apache as a module because we already have compiled and installed Apache in the previous chapter with modules support.

In regard to the previous book (Securing & Optimizing Linux: The Ultimate Solution), I've decided to explain you how to compile and install PHP with most interesting third party services like MySQL, PostgreSQL, LDAP, IMAP, and SSL support. This will let us enable or disable which service and feature we want to provide with PHP for our web server in an easy way without the need to recompile the software every time we decide to add or remove features. From the point of view of performance, there is no so big difference if we run PHP as a module with Apache.

Building PHP as a module support into the Apache web server has some interesting advantage because we can easily upgrade the software when required without the need to rebuild the whole Apache web server.

PHP (recursive acronym for "PHP: Hypertext Preprocessor") is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. PHP is mainly focused on server-side scripting, so you can do anything any other CGI program can do, such as collect form data, generate dynamic page content, or send and receive cookies. But PHP can do much more. Just look on the Internet for the myriad of open source software available in PHP language.

These installation instructions assume Commands are Unix-compatible.
The source path is /var/tmp (note that other paths are possible, at personal discretion).
Installations were tested on OpenNA Linux & Red Hat Linux 7.3.
All steps in the installation will happen using the super-user account "root".
Whether kernel recompilation may be required: No
Latest PHP version number is 4.2.3

The procedures given in this chapter are likely to work on all Linux platforms, but we have only tested it on OpenNA Linux and Red Hat Linux.

Packages

The following is based on information listed by PHP as of 2002/09/06. Please regularly check http://www.php.net/ for the latest status. We chose to install the required component from a source file because it provides the facility to fine tune the installation.

Source code is available from:
PHP Homepage: http://www.php.net/
You must be sure to download: php-4.2.3.tar.gz

Prerequisites

PHP requires that the software below is already installed on your system to be able to compile successfully. If this is not the case, you must install it. Please make sure you have this program installed on your machine before you proceed with this chapter.

Apache is required to be able to use PHP in your system.
OpenSSL is required to be able to use PHP with SSL support in your system.
imap-devel is required to be able to build PHP in your system.
mysql is required to be able to use PHP in your system.
mysql-devel is required to be able to build PHP in your system.
postgresql package is required to be able to use PHP in your system.
postgresql-devel package is required to be able to build PHP in your system.
openldap package is required to be able to use PHP in your system.
openldap-devel package is required to be able to build PHP in your system.
bzip2-devel package is required to be able to build PHP in your system.
libpng package is required to be able to use PHP in your system.
libpng-devel package is required to be able to build PHP in your system.
libjpeg package is required to be able to use PHP in your system.
libjpeg-devel package is required to be able to build PHP in your system.
freetype package is required to be able to use PHP in your system.
freetype-devel package is required to be able to build PHP in your system.
gd package is required to be able to use PHP in your system.
gd-devel package is required to be able to build PHP in your system.
aspell package is required to be able to use PHP in your system.
pspell package is required to be able to use PHP in your system.
pspell-devel package is required to be able to build PHP in your system.
perl package is required to be able to use PHP in your system.
file package is required to be able to use PHP in your system.
gmp package is required to be able to use PHP in your system.
gmp-devel package is required to be able to use PHP in your system.
zlib-devel package is required to be able to use PHP in your system.
pam-devel package is required to be able to use PHP in your system.

Pristine source

If you don't use the RPM package to install this program, it will be difficult for you to locate all the files installed on the system in the eventuality of an update in the future. To solve the problem, it is a good idea to make a list of files on the system before you install PHP, and then one afterwards, and then compare them using the diff utility to find out what files were placed where.

Simply run the following command before installing the software:
[root@deep root]# find /* > PHP1

And the following one after you install the software:
[root@deep root]# find /* > PHP2

Then use the following command to get a list of what changed:
[root@deep root]# diff PHP1 PHP2 > PHP-Installed

With this procedure, if any upgrade appears, all you have to do is to read the generated list of what files were added or changed by the program and remove them manually from your system before installing the new software. In the example above, we use the /root directory of the system to store all generated list files.
Back to top
View user's profile Send private message Visit poster's website
ShaolinTiger
Forum Fanatic
Forum Fanatic


Joined: 18 Apr 2002
Posts: 16777215
Location: Kuala Lumpur, Malaysia

Offline

PostPosted: Sat Nov 30, 2002 6:58 pm    Post subject: Reply with quote

I think Zend is the best optimisation engine for PHP, from the benchmarks I've seen, although it isn't free.

The second best is a free one although it's name passes me by.

If anyone is interested there was a complete round up and comparison of these in last months Linux Format.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   

Post new topic   Reply to topic   Printer-friendly version    Networking/Security Forums Index -> Programming and More All times are GMT + 2 Hours
Page 1 of 1


 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Looking for more Windows Networking info?

Sign up to the WindowsNetworking.com Monthly Newsletter, written by Enterprise Security MVP Deb Shinder, containing news, the hottest tips, Networking links of the month and much more. Subscribe today and don't miss a thing!
View a sample newsletter.

Become a WindowsNetworking.com member!

Discuss your Windows Networking issues with thousands of other Windows Newtorking experts. Click here to join!

Community Area

Log in | Register

Readers' Choice

Which is your preferred data recovery solution?

Follow TechGenix on Twitter