13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Securing Your <strong>Web</strong> Server <strong>and</strong> <strong>PHP</strong><br />

379<br />

<strong>PHP</strong>, the Apache HTTP Server, <strong>and</strong> Microsoft’s Internet Information Server (IIS), this<br />

means going to the appropriate website (http://www.php.net, httpd.apache.org, or<br />

www.microsoft.com/iis) on a semiregular basis <strong>and</strong> looking for security advisories, new<br />

releases, <strong>and</strong> browsing through the list of new features to see if any are indeed securityrelated<br />

bug fixes.<br />

Setting Up the New Version<br />

Configuration <strong>and</strong> installation of some of these software programs can be time consuming<br />

<strong>and</strong> require a good number of steps. Especially on the UNIX versions where you<br />

install from sources, there can be a number of other pieces of software you have to install<br />

first, <strong>and</strong> then a good number of comm<strong>and</strong>-line switches required to get all the right<br />

modules <strong>and</strong> extensions enabled.<br />

This is important: Make yourself a little installation “script” you follow whenever you<br />

install a newer version of the software.That way you can be sure you do not forget<br />

something important, which will only cause troubles later on.The number of steps is<br />

typically such that it is highly unlikely that our brains will remember every exact detail<br />

each time we run through an installation.<br />

Deploying the New Version<br />

Installations should never be done directly on the production server for the first time.You<br />

should always have a practice or test server to which you can install the software <strong>and</strong><br />

web application <strong>and</strong> make sure everything still works. Especially for a language engine<br />

such as <strong>PHP</strong>, where some of the default settings change between versions, you will<br />

absolutely want to run through a series of test suites <strong>and</strong> practice runs before you can be<br />

sure that the new version of the software does not adversely affect your application.<br />

Note that you do not necessarily need to go out <strong>and</strong> spend thous<strong>and</strong>s of dollars on a<br />

new machine to practice the setup <strong>and</strong> configuration. Many programs that allow you to<br />

run an operating system within yours, such as VMware, Inc.’s VMware or Microsoft’s<br />

VirtualPC software, will let you do this within the current operating system you are running.<br />

After you have verified that the new version of the software works well with your<br />

web application, you can deploy it to production servers. Here you should be absolutely<br />

sure that the process is either automated or again scripted on paper (or disk) so that you<br />

can follow an exact sequence of steps to replicate the correct server environment. Some<br />

final testing should be done on the live server to make sure that everything has, indeed,<br />

gone as expected (see Figure 16.2).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!