Pro PHP- Patterns, Frameworks, Testing and More

(vip2019) #1
CHAPTER 5 ■ WHAT'S NEW IN PHP 6^43

PHP 6.0.0-dev (cli) (built: Dec 13 2007 16:59:43)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v3.0.0-dev, Copyright (c) 1998-2007 Zend Technologies

The final step in setting up PHP 6 is to integrate it with your web server. If you’re using
Debian/Ubuntu, you will want to follow its module format by creating the configuration files
shown in Listings 5-1 and 5-2.

Listing 5-1. Creating /etc/apache2/mods-available/php6.load

LoadModule php6_module /usr/lib/apache2/modules/libphp6.so

Listing 5-2. Creating /etc/apache2/mods-available/php6.conf

<IfModule mod_php6.c>
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
</IfModule>

After you have created these two configuration files, remove the automatically added
content from /etc/apache2/httpd.conf. Then make this call:

> a2enmod php6

You now have PHP 6 installed and configured.
If you are not a Debian/Ubuntu user, the PHP installer should automatically update
httpd.conf with the changes listed in Listings 5-1 and 5-2. You should confirm that these
settings were added and are correct.
Next, to enable PHP 6, Apache must be reloaded. On Debian/Ubuntu systems, issue this
command:

> /etc/init.d/apache2 force-reload

And here’s the generic Apache 2 command to reload Apache:

> apache2ctl restart

To test your PHP installation, on the web server, create a .php file containing a call to the
phpinfo() function, as shown in Listing 5-3.

Listing 5-3. Getting PHP Information (/var/www/index.php)

<?php
phpinfo();

Then visit http://example.com/index.php, where example.com is the IP or domain name of
your web server. You should see “PHP Version 6.0.0-dev” on the screen, as well as information
about all the loaded modules.

McArthur_819-9C05.fm Page 43 Wednesday, February 27, 2008 8:38 AM

Free download pdf