![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
This page was last modified: July 27 2006 16:21:03 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Installing PHP v5Even if you don't know how to do programming in PHP, you will almost certainly need to install it. Hundreds of tools written in PHP is available, and I'm sure that you'll want to install a few of them some time in the near future. If you choose to install support for MySQL, you should install MySQL first if you want version 5 - If MySQL is not installed, PHP will install the mysql 4.1 client. If Apache has not been installed yet, it will be included automatically. For that reason I always install Apache first, to be sure that my preferred version of apache is installed. This means that I install in this order: apache -> mysql -> php This article assumes that you are using Apache version 2.x Installing PHPIf you plan on installing PHP 5, you must first be sure that it is supported by any php-based tool you may wish to install like phpadmin or squirrelmail. Also If you already have websites programmed under PHP 4.x, checkout the differences between version 4 and 5. I should mention that I have not encountered any problems with webbased tools, or any of my own pages written in php, when switching to PHP 5. This guide covers the installation of PHP 5. cd /usr/ports/lang/php5/ make WITH_APACHE2=yes install clean distclean ...................................................................... . Options for php5 5.0.5_1 . . .................................................................. . . . [X] APACHE2 Use apache 2.x instead of apache 1.3.x . . . . [ ] DEBUG Enable debug . . . . [ ] IPV6 Enable ipv6 support . . . . [X] OPENSSL Build static OpenSSL extension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...................................................................... . [ OK ] Cancel . ...................................................................... Remember to select APACHE2 if you have installed version 2 of Apache You move arround with arrow-up and arrow-down. Use space to X-mark the items you wan't. When finished use tab to goto OK and press enter to finish. Next thing to do, is choosing which extensions you want for PHP. If you are not sure which to choose, you should at least install those selected by default. The beauty about this is that you can always come back later and install more extentions. The below list shows what I have initially chosen:
cd /usr/ports/lang/php5-extensions
If you have included GD library support, you will be prompted for GD options:
PHP Configuration filePHP has a lot of options to play with. The file is located in /usr/local/etc/
cd /usr/local/etc/ Make a copy of the php recommended initialization file as shown above. From now on you'll make any changes in the php.ini file. Chances are that you don't need to change anything right now, but you may want to make changes once you have started programming. PHP settings in Apache's configuration file
Error logging Here's an example of how to log php errors to a file: Create a directory and make www the owner:
mkdir /var/log/php Open php.ini and set these values:
log_errors = On You don't need to create the log file. It will be created automatically the first time php encounters an error. Remember to restart Apache to make changes in php.ini take effect. But what if you don't want to log errors from www.example1.tld in the same file as www.example2.tld... or maybe you want to show errors on one site, but not on another...no problem. As mentioned earlier you can add php settings in Apaches configuration file.:
</VirtualHost *:80> How beautiful is that! PHP Configuration of ApacheFor PHP to work, Apache has to know about it.: Go to usr/local/etc/apache2 and open httpd.conf. Ensure that these two lines exist somewhere in the file: LoadModule php5_module libexec/apache2/libphp5.so AddType application/x-httpd-php .php If you want Apache to recognize other file extensions as php, you can seperate them with a space in the AddType line: AddType application/x-httpd-php .php .phtml .php4 If you haven't yet made any other changes to httpd.conf, than the above, you can proceed with Configuration of Apache |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||