![]() |
“The beast is actively interested only in now, and, as it is always now and always shall be, there is an eternity of time for the accomplishment of objects.” - the wisdom of Tarzan |
Kyng Chaos |
|
Table of Contents
PHP BuildLast change: 2005/8/27 PHP version: 4.4.0 PHP has a lot of optional features. What I build here includes everything in the Apple-supplied PHP, and what MapServer needs, plus anything else that I don't use but is easy to add (quite a lot really). If you need a specific feature that I haven't enabled, you're on your own, but it shouldn't be too difficult. NOTE: Tho the Apple PHP will work for Mapserver, it's missing many features and I really recommend building your own. In a Terminal type (supply admin password when asked): $ cd path_to_folder_containing_php_source.tar.gz $ tar -zxf php-4.4.0.tar.gz If you want pdflib support, there is a bit of work to do (it's a little more involved than it used to be, since pdflib lite doesn't include the updates we need any more. First, we need to grab in install the updates, then rebuild configure (ignore warnings about autoconf version): $ pear download pdflib $ tar -zxf pdflib-2.0.4.tgz (substitute whatever version is downloaded in this and the following commands) $ cp -f pdflib-2.0.4/pdflib-2.0.4/* php-4.4.0/ext/pdf/ $ cd php-4.0.0 $ rm configure $ ./buildconf --force $ cd .. And continue: $ cd php-4.4.0 $ ./configure --mandir=/usr/local/share/man --with-gd=/usr/local --with-png-dir=/usr/local --with-zlib=/usr --with-bz2=/usr --with-jpeg-dir=/usr/local --with-freetype-dir=/usr/local --with-xpm-dir=/usr/X11R6 --enable-exif --with-xml --enable-wddx --enable-ftp --enable-mbstring --enable-mbregex --with-openssl --with-iconv=/usr --enable-force-cgi-redirect --enable-dbase --enable-gd-jis-conv --enable-gd-native-ttf --with-curl=/usr --with-tiff-dir=/usr/local --enable-zend-multibyte --with-ldap=/usr --with-kerberos=/usr --enable-dbx --enable-sockets --with-iodbc=/usr --with-xmlrpc --with-expat-dir=/usr/local --enable-calendar --enable-trans-sid If you installed pdflib, add this to the configure line: --with-pdflib=/usr/local If you installed MySQL, add this to the configure line: --with-mysql=/usr/local/mysql If you installed PostgreSQL, add this to the configure line: --with-pgsql=/usr/local/pgsql If you want to try MapServer with PHP as an Apache module, add this to the configure line (requires at least MapServer 4.4): --with-apxs otherwise add: --with-regex=system and continue: $ make $ sudo make install If you are building PHP as a CGI, finish up with: $ sudo cp sapi/cgi/php /Library/Webserver/CGI-Executables If you are building PHP as an Apache module, we want it out of the way so Apple doesn't stomp it in an update: $ sudo mkdir -p /usr/local/libexec/httpd $ sudo cp -f /usr/libexec/httpd/libphp4.so /usr/local/libexec/httpd/ Apache Module Setup
If this is the first time you installed PHP at all, and you built it as an Apache module, the install should have enabled PHP for you. But, it's pointing to the default Apache module folder, and we want to make sure ours is used, even if Apple updates PHP. Edit LoadModule php4_module /usr/local/libexec/httpd/libphp4.so If there are any extra LoadModule lines for php4, delete them (they can get added on Apple updates and your own build updates. Then, just start up the webserver and test it as specified below.
If you had previously installed PHP as a CGI, then you must manually disable the CGI (the Apache module is still automatically enabled). Edit CGI Setup
PHP as a CGI needs a bit of setup to get it running with the Apache web server. Edit
Now look for the section Action php-script /cgi-bin/php AddHandler php-script .php .phtml Start and TestThen start up the web server: System Preferences → Sharing → Services and check Personal Web Sharing. If you are updating PHP, turn Web Sharing off and back on.
Now a quick test. In your web root ( <?php phpinfo (); ?>
Then open up Safari and go to this URL: localhost/testphp.php (or localhost/~you/testphp.php). You should see a long page of the gorey details of your PHP installation. Make sure that the Server API line corresponds to how you installed it above. If not, there's something wrong in httpd.conf. One last thing to do now to tune PHP - look at the line on this info page for Configuration File Path. It should be $ sudo cp php.ini-recommended /usr/local/lib/php.ini Note that you are renaming the file in the process. Edit this file now. First, find the line that sets extension_dir, add a semicolon at the beginning to comment it.
With php-mapscript you may have complex maps that take a while to draw, or you may have a slow Mac, so it would be a good idea to increase the timeout: find the variable max_execution_time and increase it to 60 seconds or more. If you find maps that take longer (and you can't speed them up), just increase this again. (Try to speed them up, tho - you don't want to frustrate your viewers If you have installed PHP as an Apache module, you must restart Web Sharing after making any changes to php.ini.
Reload the php test page and see the changes. You're all set. Note that this 'recommended' php.ini turns off display errors and instead logs them. If you need to debug your php you must look at the web server logs or temporarily turn on display errors in your php ( Bonus SpeedupA note on the recent PHP 4.3.10 turned me on to this little goody that can speed up your php-driven web pages: the Zend Optimizer. Download it, and in a Terminal: $ cd path_to_folder_containing_zendoptimizer.tar.gz $ tar -zxf ZendOptimizer-2.5.7-darwin7.5-ppc.tar.gz $ cd ZendOptimizer-2.5.7-darwin7.5-ppc $ sudo ./install.sh
An old-style DOS-GUI thing will walk you thru installation. The defaults should be good. Note that this will move your php.ini to |
| Copyright © 2004-2008 Kyng Chaos All trademarks and copyrights on this page are owned by their respective owners. |
Powered By Geeklog |