<?xml version="1.0" encoding="utf-8"?>
<!-- generator="wordpress/2.1.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>Professional PHP</title>
	<link>http://www.procata.com/blog</link>
	<description>PHP Programming, Web Development, PHP Advocacy and PHP Best Practices.</description>
	<pubDate>Mon, 12 May 2008 05:04:21 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1.2</generator>
	<language>en</language>
			<item>
		<title>Benchmarking PHP&#8217;s Magic Methods</title>
		<link>http://www.procata.com/blog/archives/2007/11/04/benchmarking-phps-magic-methods/</link>
		<comments>http://www.procata.com/blog/archives/2007/11/04/benchmarking-phps-magic-methods/#comments</comments>
		<pubDate>Mon, 05 Nov 2007 00:01:02 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Software Design]]></category>
<category>benchmarks</category><category>performance optimization</category><category>profiling</category>
		<guid isPermaLink="false">http://www.procata.com/blog/archives/2007/11/04/benchmarking-phps-magic-methods/</guid>
		<description><![CDATA[Larry Garfield has an interesting set of benchmarks covering many of PHP&#8217;s magic methods.  His results correspond pretty well to my own benchmarks in the area.  The thing to take away is that its not necessarily the overhead of the magic methods, but rather what you do inside them.  Its hard to [...]]]></description>
			<content:encoded><![CDATA[<p>Larry Garfield has an interesting <a href="http://www.garfieldtech.com/blog/magic-benchmarks">set of benchmarks</a> covering many of PHP&#8217;s <a href="http://php.net/oop5.magic">magic methods</a>.  His results correspond pretty well to my own benchmarks in the area.  The thing to take away is that its not necessarily the overhead of the magic methods, but rather what you do inside them.  Its hard to do anything useful inside a magic method, such as __get or __call that isn&#8217;t <b>10 to 20 times slower</b> than the &#8220;non-magic&#8221; solution.</p>
<p>There are probably more than a few naive programmers who would read results like this and start to avoid these constructs in their own code for performance reasons.  These are the same kinds of people obsessing over a few single or double quotes, who eschew &#8220;slow&#8221; objects in favor of switch statements that are many times slower than the polymorphic method calls they are trying to avoid.</p>
<p>But, that&#8217;s not the end of the story.  Larry ran his benchmarks using 2,000,000 iterations.  The <b>N</b> really matters here.  Sure, iterators are slower than arrays, but you aren&#8217;t going to be iterating over two million things.  I tend to fetch my database records in lots of 25 or 50.  You aren&#8217;t going to be making two million invocations of __call.  But how many will you make?  Under what value of N does the performance of these techniques cease to matter?  Is it ten, one hundred, one thousand, or ten thousand?  You may be surprised at how few calls your program actually does and how little impact it has on performance.</p>
<p>As <a href="http://netevil.org/">Wez</a> and <a href="http://www.travisswicegood.com/">Travis</a> point out in their comments, profiling is the way to find out the potential impact and to discover your true N.</p>
<p>Paul M. Jones has a <a href="http://paul-m-jones.com/blog/?p=182">good example</a> of what I&#8217;m talking about.  There, call_user_func_array appears to be a bottleneck, but it turns out that its the function being called, htmlspecialchars, not the calling process that consumes the balance of the time.  In that case, the function was &#8220;only&#8221; called 300 times.  I find that order of magnitude to be fairly typical.  Something to be aware of, perhaps, but not something to obsess over.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2007/11/04/benchmarking-phps-magic-methods/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Endpoints of the Scale of Stupidity on Video</title>
		<link>http://www.procata.com/blog/archives/2007/11/02/the-endpoints-of-the-scale-of-stupidity-on-video/</link>
		<comments>http://www.procata.com/blog/archives/2007/11/02/the-endpoints-of-the-scale-of-stupidity-on-video/#comments</comments>
		<pubDate>Fri, 02 Nov 2007 20:55:22 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Software Design]]></category>
<category>oop</category>
		<guid isPermaLink="false">http://www.procata.com/blog/archives/2007/11/02/the-endpoints-of-the-scale-of-stupidity-on-video/</guid>
		<description><![CDATA[A quote from Cal Henderson (via simonwillison) presents a &#8220;Web Application Scale of Stupidity:&#8221;

&#124; OGF (One Giant Function) ---- Sanity ---- OOP (Object Oriented Programming) &#124;

The scale that Cal is talking about is actually better known as modularity:

&#124; Few large modules ----  Sanity? ---- Many Small Modules &#124;

If you haven&#8217;t listened to Alan Kay [...]]]></description>
			<content:encoded><![CDATA[<p>A quote from Cal Henderson (via <a href="http://simonwillison.net/2007/Nov/2/cal/">simonwillison</a>) presents a &#8220;Web Application Scale of Stupidity:&#8221;<br />
<code><br />
| OGF (One Giant Function) ---- Sanity ---- OOP (Object Oriented Programming) |<br />
</code></p>
<p>The scale that Cal is talking about is actually better known as <a href="http://sunnyday.mit.edu/16.355/parnas-criteria.html">modularity</a>:</p>
<p><code><br />
| Few large modules ----  Sanity? ---- Many Small Modules |<br />
</code></p>
<p>If you haven&#8217;t listened to Alan Kay talk about the benefits of many small modules, you should do so now.  Alan Kay coined the term Object Oriented.  Love OO or hate OO, if you have an opinion on it, you should know what he was thinking.  Hint, it wasn&#8217;t C++.</p>
<p><embed style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=-2950949730059754521&#038;hl=en" flashvars=""> </embed></p>
<p>On the other end of the scale, One Giant Function is generally known as <a href="http://www.laputan.org/pub/foote/mud.pdf">Big ball of Mud</a>(PDF)  Here is Brian Foote&#8217;s presentation on the paper (read the paper first).</p>
<p><embed style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=8693679271218408739&#038;hl=en" flashvars=""> </embed></p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2007/11/02/the-endpoints-of-the-scale-of-stupidity-on-video/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Working with PHP 5 in Mac OS X 10.5 (Leopard)</title>
		<link>http://www.procata.com/blog/archives/2007/10/28/working-with-php-5-in-mac-os-x-105/</link>
		<comments>http://www.procata.com/blog/archives/2007/10/28/working-with-php-5-in-mac-os-x-105/#comments</comments>
		<pubDate>Mon, 29 Oct 2007 00:48:44 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Mac]]></category>
<category>apache</category><category>mysql</category><category>php 5</category>
		<guid isPermaLink="false">http://www.procata.com/blog/archives/2007/10/28/working-with-php-5-in-mac-os-x-105/</guid>
		<description><![CDATA[Mac OS X is a great development platform for working with PHP.  Leopard comes with Apache, PHP and many other development tools, such as subversion already installed.  Leopard brings a much needed upgrade from Tiger&#8217;s tired PHP 4 to a very modern version of PHP 5.2.4.  This is a guide for setting [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.procata.com/blog/wp-content/uploads/2007/10/php-med-trans-light.gif' alt='PHP' align="right" />Mac OS X is a great development platform for working with PHP.  Leopard comes with Apache, PHP and many other development tools, such as subversion already installed.  Leopard brings a much needed upgrade from Tiger&#8217;s tired PHP 4 to a very modern version of PHP 5.2.4.  This is a guide for setting up a PHP development environment under 10.5 using the version of PHP that ships with leopard.</p>
<p>You may prefer to use one of the 3rd party distributions of PHP, such as <a href="http://www.mamp.info/en/index.php">MAMP</a>, <a href="http://www.apachefriends.org/en/xampp-macosx.html">XAMPP</a> or <a href="http://www.entropy.ch/software/macosx/php/">Marc Liyanage</a>.  This is a guide to using the version of PHP that comes with 10.5.</p>
<h3>Enable Developer Tools</h3>
<p>These steps may not be strictly necessary for this process, but I find it useful to do them.<br />
First, <a href="http://docs.info.apple.com/article.html?artnum=106290">enable your root password</a>.<br />
You may also want to install XCode Tools from your Leopard disk (or grab the latest from <a href="http://developer.apple.com/tools/">Apple developer tools</a>).  The tools are required is you are going to compile any extensions for PHP.</p>
<h3>Editing Configuration Files</h3>
<p>We will have to edit several configuration files that exist as part of the unixy underpinnings of OS X.  I&#8217;m going to recommend the free text editor, <a href="http://www.barebones.com/products/textwrangler/">TextWrangler</a> for this purpose.  Normally, the finder hides the configuration files from view.  However, in the finder, you can use the &#8220;Goto Folder&#8230;&#8221; option under the &#8220;Go&#8221; menu to view these files.  This option if available via command-shift-G.  Actually, this option is available in any file open dialog in OS X via command-shift-G.  In addition, Text Wrangler will allow you to browse these files with its &#8220;open hidden&#8230;&#8221; option.  But, the much easier option is selecting &#8220;Open file by name&#8230;&#8221; (command-D) and just typing the full path and filename.  To save many of these files, you will need to enter your root password.  Be Careful.</p>
<h3>Enabling PHP</h3>
<p>PHP is installed in Mac OS X by default, but not enabled.  To enable it, we must edit the apache 2 configuration file, which is located at <samp>/etc/apache2/httpd.conf</samp>.  Find the line which loads the PHP 5 module, which looks like this:<br />
<code><br />
#LoadModule php5_module        libexec/apache2/libphp5.so<br />
</code><br />
The line is currently commented out.  All we have to do is remove the comment symbol, <samp>#</samp>, so the line looks like this:<br />
<code><br />
LoadModule php5_module        libexec/apache2/libphp5.so<br />
</code><br />
Save.</p>
<h3>Starting Apache</h3>
<p>Go to the sharing panel in system preferences and enable &#8220;Web Sharing.&#8221;  This will start the apache server.<br />
<a href='http://www.procata.com/blog/wp-content/uploads/2007/10/web-sharing.png' title='Sharing Panel'><img src='http://www.procata.com/blog/wp-content/uploads/2007/10/web-sharing.png' alt='Sharing Panel' /></a><br />
Another way to do this is to type the following in the Terminal application:<br />
<code><br />
sudo apachectl start<br />
</code><br />
You will be prompted to enter your root password.  After that, your apache server should now be running.  If you need to restart the server from the terminal, you can type this:<br />
<code><br />
sudo apachectl restart<br />
</code><br />
If you find this tedious to type, there is a script that you can download to do this later in this post.</p>
<h3>Visiting our Web Site</h3>
<p>Now, lets check our work.  In the sharing panel, you can click on the URL under &#8220;Your computer&#8217;s website.&#8221;  Alternatively, in the web browser, go to the url <a href="http://localhost/">http://localhost/</a>.  localhost is a special name that means &#8220;My computer.&#8221;  If your web server is working, you should see a page titled &#8220;Test Page for Apache Installation.&#8221;  If you go to <a href="http://localhost/manual/">http://localhost/manual/</a>, you can read an Apache 2.2 manual, hosted from your own server.  But, this don&#8217;t tell you that PHP is working.<br />
For that, we&#8217;ll have to create a very simple php program.  Create a new file in TextWrangler and type the following:<br />
<pre class="php">&nbsp;
&lt; ?php <a href="http://www.php.net/phpinfo"><span style="color: #000066;">phpinfo</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;</pre><br />
(Don&#8217;t just copy and paste this.  Note that there should be no space between the <samp>&lt;</samp> and the <samp>?php</samp>.  The WordPress software I use for this blog inserts an extra space.)<br />
Save this using the file name <samp>info.php</samp> in the <samp>/Library/WebServer/Documents/</samp> directory.  (start from the top level directory of your hard drive, not the library directory in your home directory.  Now you should be able to visit the PHP page you just created by visiting <a href="http://localhost/info.php">http://localhost/info.php</a>.  You should see the PHP logo and a big table of configuration information.</p>
<h3>Showing the World</h3>
<p>For security purposes, you should consider that anything you put in your <samp>WebServer/Documents</samp> folder will be available across the web.  If you have information that you want to keep private, think twice about putting it there, unless you know how to protect it.<br />
But, if you want people to see the pages that you are sharing, there can be a few obstacles.  You can give out the URL that is listed in the sharing control panel under &#8220;Your computer&#8217;s website.&#8221;  However, if you are behind a <a href="http://en.wikipedia.org/wiki/Network_address_translation">NAT</a> router, such as I am, this IP address based url will only work for other computers on your network and not for the internet as a whole.  You may have to configure network router or firewall in order to discover your true ip address and to route web server requests to that IP to your computer.  Doing this is beyond the scope of this tutorial.<br />
Additionally, IP address based urls don&#8217;t make good urls to share.  IP addresses can change.  If you plan to host a permanent web site, you may want to purchase a domain name and point it to your Mac.  This also, is beyond the scope of this tutorial.<br />
Perhaps the best option is to purchase both a domain name and professional hosting.  Apache based PHP Hosting is widely available and cheap.  You can get support from a good host on uploading your files to the remote server.  I&#8217;m going to presume that you will use one of the many excellent PHP hosting options and are only configuring PHP on your own machine for education, testing or development purposes.</p>
<h3>Enabling a Personal Website</h3>
<p>If you clicked on the URL under &#8220;Your Personal Website,&#8221; you might have gotten a page that says forbidden.  This is because in the default configuration in Leopard, unlike in Tiger, does not allow Apache to serve documents from home directories.  If you want to enable this feature, you have to create a new Configuration file.<br />
Create a new file with the following contents and save it to <samp>/etc/apache2/users/jeff.conf</samp>.<br />
<pre class="xml">&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;directory</span> <span style="color: #ff0000;">&quot;/Users/jeff/Sites&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/directory<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;</pre><br />
Replace &#8220;jeff&#8221; with your user name, which is also the name of your home directory.  Exact capitalization is imporant.  This tells the Apache server that it is ok to serve web content out of the <samp>~jeff</samp> directory.  You will have to restart Apache for this to take effect.<br />
You may also have to create a <samp>Sites</samp> folder in your home directory to hold the files you want to serve.  Leopard will automatically bless this folder with a special Icon.</p>
<h3>Virtual Hosting</h3>
<p>If you want to experiment with or work on more than one site at a time, the single directory in WebServer Documents and the Personal Websites configuration don&#8217;t work well.  Projects collide and files outside of your home directory can be harder to work with.  The answer to this is to setup virtual hosting.  Lets turn our Personal Website sharing solution into a virtual hosting solution that allows us to work with multiple websites as subdirectories of our Sites folder.<br />
So, lets create a sample site, called mysite.  We&#8217;ll create a folder called &#8220;mysite&#8221; as a sub folder of our Sites folder.  Capitalization is important.<br />
Now, we are going to want to access our site with an easy to use domain name, so that our url is <samp>http://mysite/</samp>.  There is an easy way to create new domain names that are only for personal use.  To do this, we can add it to our <samp>/etc/hosts</samp> file.  Add the following lines at the end of this file:<br />
<code><br />
# My local aliases<br />
127.0.0.1	mysite<br />
</code><br />
127.0.0.1 is a special IP address designation that never changes and corresponds to localhost to mean this computer.  We are telling our Mac that the name mysite is hosted on the local computer.  This rule is only in effect on the same machine.  If you go to a different machine, you cannot use the <samp>http://mysite/</samp> url.<br />
Now we need to configure apache for virtual hosting.  We are going to have to edit our <samp>/etc/apache2/users/jeff.conf</samp> file.  Change the contents of this file to the following:<br />
<pre class="xml">&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;directory</span> <span style="color: #ff0000;">&quot;/Users/jeff/Sites/*/&quot;</span><span style="font-weight: bold; color: black;">&gt;</span></span>
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/directory<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;
NameVirtualHost *:80
&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;virtualhost</span> *:<span style="color: #cc66cc;">80</span><span style="font-weight: bold; color: black;">&gt;</span></span>
    DocumentRoot /Users/jeff/Sites/mysite
    ServerName mysite
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/virtualhost<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;</pre><br />
Remember to replace &#8220;jeff&#8221; with your user name.  Place your <samp>info.php</samp> test file into the mysite directory and rename it to <samp>index.php</samp>.  Now, restart your apache server.  When you visit <samp>http://mysite/</samp>, you should now see the familiar php logo and information page.<br />
If you want to add another site, just add a second line in your hosts file, another subdirectory of Sites and append the following to your apache configuration file:<br />
<pre class="xml">&nbsp;
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;virtualhost</span> *:<span style="color: #cc66cc;">80</span><span style="font-weight: bold; color: black;">&gt;</span></span>
    DocumentRoot /Users/jeff/Sites/myothersite
    ServerName myothersite
<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/virtualhost<span style="font-weight: bold; color: black;">&gt;</span></span></span>
&nbsp;</pre></p>
<h3>Sharing with the World, Part II</h3>
<p>Sharing your virtual hosted sites with the world is more complicated if you don&#8217;t have a domain name setup.  You can, however, add your hosts files entries to other computers that you want to share with.  However, you have to change the 127.0.0.1 IP address to the IP address of your computer, taking into account any NAT.<br />
There is a special case of this.  If you are using parallels, perhaps for test viewing your pages in internet explorer, you may want your virtual hosted sites to be available.  The good news is that Windows also supports a <a href="http://en.wikipedia.org/wiki/Hosts_file">hosts</a> file. Here is how to <a href="http://www.mvps.org/winhelp2002/hostsfaq.htm">edit your windows hosts file</a>.  The big problem is knowing what IP address to use.  You can&#8217;t use 127.0.0.1 on the windows side because that is the virtual windows machine, not your Mac&#8217;s address.   You can use the IP address shown on your network system preferences panel, 192.168.1.100 for me.  But, this number is subject to change and you will have to re-edit your hosts file on the windows side.<br />
If you are using Parellels, be sure to upgrade to the new <a href="http://www.parallels.com/en/products/desktop/beta/">beta version</a> for Leopard, build 5540.  Once you&#8217;ve done that, if you visit the network panel in system preferences and select the &#8220;Parallels Host-Guest&#8221; network, you will see the IP address that parallels assigns to your host machine.  (assuming you are using Shared Networking.)  You can then use this IP address in your windows hosts file.  You may also be able to change &#8220;Using DHCP&#8221; to &#8220;Using DHCP with Manual address&#8221; and re-entering this number if you have a problem with the number changing.  Here, my number is 10.37.129.3:</p>
<p><img src='http://www.procata.com/blog/wp-content/uploads/2007/10/parallels.png' alt='Network Preferences panel' /></p>
<h3>Installing MySQL</h3>
<p>MySQL has a binary distribution for Mac OS X.  They also have reasonably good documentation on <a href="http://dev.mysql.com/doc/refman/5.0/en/mac-os-x-installation.html">installing MySQL on Mac OS X</a> for their distribution.  Note that Leopard specific packages for MySQL have not been created yet.</p>
<h3>Starting MySQL</h3>
<p>So far, the MySQL preferences panel from the Tiger release is broken and does not correctly start and stop MySQL (<a href="http://bugs.mysql.com/bug.php?id=31889">bug report</a>.  You can do this from the terminal window with<br />
<code><br />
sudo /usr/local/mysql/support-files/mysql.server start<br />
</code><br />
To shutdown the server type:<br />
<code><br />
sudo /usr/local/mysql/support-files/mysql.server stop<br />
</code><br />
If you find this tedious to type, you can download <a href="http://www.procata.com/software/WebDevCP.dmg">WebDevCP</a>, which is a small AppleScript application that I made. Launching WebDevCP launches both Apache and MySQL.  Quitting the application shuts them both down.  usually.  Launching and quitting requires a password.  No warranty on this thing.  It was just something I was using personally and figured others might find useful.</p>
<h3>Bring the mysql.sock to PHP</h3>
<p>One problem that has come about with MySQL and Leopard is the location of the <samp>mysql.sock</samp> file.  Previously, the default location for this file was in the <samp>/tmp</samp> directory.  That location has now moved to the <samp>/var/mysql</samp> directory.  PHP will look for it there.  Unfortunately, the default location from the MySQL will still place it in the old location.  We can fix this by creating a <samp>my.cnf</samp> configuration file in the /etc directory.  Save a file with the following contents to <samp>/etc/my.cnf</samp>:<br />
<code><br />
[client]<br />
socket = /var/mysql/mysql.sock</p>
<p>[mysqld]<br />
socket = /var/mysql/mysql.sock<br />
</code><br />
In the terminal window, type the following commands to create the directory for the sock file:<br />
<code><br />
sudo mkdir /var/mysql<br />
sudo chown _mysql /var/mysql<br />
</code><br />
One drawback to this is that if you have installed the MySQL GUI tools, they will look for the <samp>mysql.sock</samp> file at the old location.  You can enter the new socket in the connection dialog under More Options, there is a box labeled &#8220;connect using socket.&#8221;  Just enter <samp>/var/mysql/mysql.sock</samp>.<br />
Another solution is to change the <samp>php.ini</samp> file to expect the socket in a different location.  I&#8217;m going with the <samp>my.cnf</samp> option because I expect the MySQL will have a Leopard version out in a few days that changes the default location.</p>
<h3>Where is PEAR?</h3>
<p>OS X has traditionally had problems with <a href="http://pear.php.net/">PEAR</a>.  Many point updates would overwrite the included version of PEAR with an older, and perhaps insecure version.  Sadly, Apple has fixed this by not including PEAR at all in their OS.  This is a big inconvenience for people wanting to use Apple&#8217;s default version of PHP, versus a third party distribution.  So, lets get PEAR installed.  Type the following in the terminal window to download the PEAR installer:<br />
<code><br />
curl http://pear.php.net/go-pear > go-pear.php<br />
</code><br />
after that, type<br />
<code><br />
sudo php -q go-pear.php<br />
</code><br />
To run it.  Hit enter to select the default locations.  PEAR will be installed, but it won&#8217;t be ready to use until we modify our <samp>php.ini</samp> file.</p>
<h3>PHP .ini configuration</h3>
<p>Now we need to make some changes to our php configuration file.  Leopard has an empty configuration file by default, but provides a file which you can use as a template.  From the terminal window, type:<br />
<code><br />
sudo cp /etc/php.ini.default /etc/php.ini<br />
</code><br />
Now, edit the <samp>/etc/php.ini</samp> file.  Find the <samp>include_path</samp> setting:<br />
<code><br />
;include_path = ".:/php/includes"<br />
</code><br />
And change it to<br />
<code><br />
include_path = ".:/usr/share/pear"<br />
</code><br />
This enables our PEAR installation.  You may also want to make some changes which will improve your ability to debug PHP.  FInd the line that says<br />
<code><br />
log_errors = Off<br />
</code><br />
and change it to<br />
<code><br />
log_errors = On<br />
</code><br />
You have to then restart Apache for these PHP changes to go into effect.</p>
<h3>Errors and Omissions</h3>
<p>Thats all there is to using the version of PHP delivered with OS X.  If you find this confusing, you are probably better off with something like XAMPP or MAMP.  I&#8217;ll probably end up compiling my own versions of PHP, but that is a different blog post.  I&#8217;ve already had problems with this configuration when I tried to install XDebug via PECL.  One last thing, if you run into problems, you can check the apache2 error_log file using the Console application.</p>
<p>For support, try the <a href="http://www.sitepoint.com/forums/">Sitepoint forums</a> or Apple&#8217;s <a href="http://discussions.apple.com/">Discussion Forums</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2007/10/28/working-with-php-5-in-mac-os-x-105/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Keywords and Language Simplicity</title>
		<link>http://www.procata.com/blog/archives/2007/10/11/keywords-and-language-simplicity/</link>
		<comments>http://www.procata.com/blog/archives/2007/10/11/keywords-and-language-simplicity/#comments</comments>
		<pubDate>Thu, 11 Oct 2007 18:38:26 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
		
		<category><![CDATA[PHP]]></category>
<category>language comparison</category><category>perl</category><category>php</category><category>programming language</category><category>ruby</category>
		<guid isPermaLink="false">http://www.procata.com/blog/archives/2007/10/11/keywords-and-language-simplicity/</guid>
		<description><![CDATA[Well, I like programming language comparisons, so how could I resist this chart (via) promoting the simplicity of the io language by pointing out how few keywords it has.  The interesting thing about this is that Java and PHP are tied on this measure of simplicity with 53 keywords.  Perhaps that reflects Java&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I like programming language comparisons, so how could I resist <a href="http://iolanguage.com/about/simplicity/">this chart</a> (<a href="http://programming.reddit.com/info/2z11k/comments">via</a>) promoting the simplicity of the io language by pointing out how few keywords it has.  The interesting thing about this is that Java and PHP are tied on this measure of simplicity with 53 keywords.  Perhaps that reflects Java&#8217;s heritage as a simplification of C++ (63 keywords) and PHP&#8217;s heritage as an amplification of C (37 keywords) toward a specific purpose?  As usual, Perl is the poster child for language complexity.  Ruby does well with 40 keywords. But, before the Ruby fans get too uppity about the simplicity of their language, they should contemplate the <a href="http://www.zenspider.com/Languages/Ruby/QuickRef.html#18">cat walked across the keyboard while I was holding down the shift key</a> predefined variables that they inherited from Perl.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2007/10/11/keywords-and-language-simplicity/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Improved Error Messages in PHP 5</title>
		<link>http://www.procata.com/blog/archives/2007/10/07/improved-error-messages-in-php-5/</link>
		<comments>http://www.procata.com/blog/archives/2007/10/07/improved-error-messages-in-php-5/#comments</comments>
		<pubDate>Sun, 07 Oct 2007 22:13:04 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
		
		<category><![CDATA[PHP]]></category>
<category>php 5</category>
		<guid isPermaLink="false">http://www.procata.com/blog/archives/2007/10/07/improved-error-messages-in-php-5/</guid>
		<description><![CDATA[Sometimes its the little things that make a difference.  If you run the this test program in PHP 4 (tested on 4.4.7):
&#60; ?php
function test&#40;$arg&#41; &#123; echo &#34;talk like a pirate.&#34;; &#125;
test&#40;&#41;;
?&#62;
You get the following message:
Warning: Missing argument 1 for test() in /usr/bin/- on line 2
The error message here is reported at the position of [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes its the little things that make a difference.  If you run the this test program in PHP 4 (tested on 4.4.7):<br />
<pre class="php">&lt; ?php
<span style="color: #000000; font-weight: bold;">function</span> test<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$arg</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;talk like a pirate.&quot;</span>; <span style="color: #66cc66;">&#125;</span>
test<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre><br />
You get the following message:</p>
<p><code>Warning: Missing argument 1 for test() in /usr/bin/- on line 2</code></p>
<p>The error message here is reported at the position of the definition of the function, but really the error was in how the function was called.  The required parameter to test was not passed.  This error can be annoying, forcing you to consult a stack trace to find the actual error location.  Something some beginners may not know how to do.</p>
<p>However, if you run the same message in PHP 5 (tested on 5.2.2):</p>
<p><code>Warning: Missing argument 1 for test(), called in /Users/jeff/- on line 3 and defined in /Users/jeff/- on line 2</code></p>
<p>Sweet improvement!</p>
<p>One more reason to ditch PHP 4 and go php 5.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2007/10/07/improved-error-messages-in-php-5/feed/</wfw:commentRss>
		</item>
		<item>
		<title>php&#124;tek Slides</title>
		<link>http://www.procata.com/blog/archives/2007/05/19/phptek-slides/</link>
		<comments>http://www.procata.com/blog/archives/2007/05/19/phptek-slides/#comments</comments>
		<pubDate>Sat, 19 May 2007 19:41:20 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
		
		<category><![CDATA[PHP]]></category>
<category>conference</category><category>php</category>
		<guid isPermaLink="false">http://www.procata.com/blog/archives/2007/05/19/phptek-slides/</guid>
		<description><![CDATA[Well, php&#124;tek is over.  It was a great conference and I&#8217;m really glad I went.  This was my first PHP conference.
One of my main goals was to meet some of the folks at php&#124;architect.  I&#8217;ve been writing the Test Pattern column for them for over a year now.  I was finally [...]]]></description>
			<content:encoded><![CDATA[<p>Well, php|tek is over.  It was a great conference and I&#8217;m really glad I went.  This was my first PHP conference.</p>
<p>One of my main goals was to meet some of the folks at php|architect.  I&#8217;ve been writing the Test Pattern column for them for over a year now.  I was finally able to put faces to the names that I keep seeing in my email box.  Actually, one of the cooler things about the conference was meeting people who I&#8217;m familiar with from online, either from forums, IRC, mailing lists or blogs.</p>
<p>I&#8217;d like to thank everyone who attended my sessions.  Here are the slides from each session:</p>
<ul>
<li><a href="http://www.procata.com/talks/phptek-may2007-maintainable.pdf">Writing Maintainable PHP Code</a> (PDF)  - based on my <a href="http://www.phparch.com/issue.php?mid=76">March 2006</a> column.</li>
<li><a href="http://www.procata.com/talks/phptek-may2007-dependency.pdf">Dependency Injection</a> (PDF) - based on my <a href="http://www.phparch.com/issue.php?mid=82">June 2006</a> column.</li>
<li><a href="http://www.procata.com/talks/phptek-may2007-exceptional.pdf">Exceptional PHP</a> (PDF) - based on my <a href="http://www.phparch.com/issue.php?mid=94">December 2006</a> column.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2007/05/19/phptek-slides/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Let Your Properties be Properties</title>
		<link>http://www.procata.com/blog/archives/2007/05/08/let-your-properties-be-properties/</link>
		<comments>http://www.procata.com/blog/archives/2007/05/08/let-your-properties-be-properties/#comments</comments>
		<pubDate>Tue, 08 May 2007 17:41:51 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Software Design]]></category>
<category>php patterns</category><category>properties</category><category>refactoring</category>
		<guid isPermaLink="false">http://www.procata.com/blog/archives/2007/05/08/let-your-properties-be-properties/</guid>
		<description><![CDATA[There is a coding pattern that I see (and have used) in PHP code that defines generic methods on a class for setting and getting properties.
&#160;
function set&#40;$name, $value&#41;;
function get&#40;$name&#41;;
&#160;Google code search for examples
Some times there are some ancillary methods to deal with unsetting, checking for existence, setting via an array, or dealing with references in [...]]]></description>
			<content:encoded><![CDATA[<p>There is a coding pattern that I see (and have used) in PHP code that defines generic methods on a class for setting and getting properties.<br />
<pre class="php">&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> set<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$name</span>, <span style="color: #0000ff;">$value</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">function</span> get<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$name</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre><a href="http://www.google.com/codesearch?hl=en&#038;lr=&#038;q=lang%3Aphp+function%5Cs%2Bset%5Cw*%5Cs*%5C%28%5Cs*%5C%24name%5Cs*%2C%5Cs*%26%3F%5Cs*%5C%24value%5Cs*%5C%29&#038;btnG=Search">Google code search for examples</a></p>
<p>Some times there are some ancillary methods to deal with unsetting, checking for existence, setting via an array, or dealing with references in PHP 4.  They can really clutter up the definition of a class.  That&#8217;s not good.  All this code is fairly standard, too, but it gets duplicated on every class that does this.  That&#8217;s not good, either.</p>
<p>Oh, I&#8217;ll solve this problem by making a base class, some may say.  Wrong.  This a very feeble reason to spend your one shot at inheritance.  Trust me, I know, I&#8217;ve done it.</p>
<p>I think the idea is to make the class extensible.  But PHP is really ok with just setting new properties on a class.<br />
<pre class="php">&nbsp;
<span style="color: #0000ff;">$obj</span>-&gt;<span style="color: #006600;">foo</span> = <span style="color: #ff0000;">'bar'</span>;
&nbsp;</pre><br />
So why not just do this?</p>
<p>Another variation of this pattern is to use setXXX($name, $value) or setYYY($name, $value) methods.  This happens alot with &#8220;options&#8221; or &#8220;vars&#8221; or &#8220;properties.&#8221;  It also happens on request wrapper classes.  To me this looks like there is an object here just begging to get out for each XXX and YYY.<br />
<pre class="php">&nbsp;
<span style="color: #0000ff;">$obj</span>-&gt;<span style="color: #006600;">xxx</span>-&gt;<span style="color: #006600;">prop</span> = <span style="color: #ff0000;">'foo'</span>;
<span style="color: #0000ff;">$obj</span>-&gt;<span style="color: #006600;">yyy</span>-&gt;<span style="color: #006600;">prop</span> = <span style="color: #ff0000;">'foo'</span>;
<span style="color: #0000ff;">$obj</span>-&gt;<span style="color: #006600;">zzz</span>-&gt;<span style="color: #006600;">prop</span> = <span style="color: #ff0000;">'foo'</span>;
&nbsp;</pre><br />
This eliminates a slew of property manipulation methods and leaves the original class free to implement its true purpose.  Methods of the form getXXX($name) and setXXX($name, $value) should be the solution of last resort.  </p>
<p>Since I&#8217;ve started eliminating these in my own code in favor of direct properties, intermediate objects or __set and __get, I feel I&#8217;ve seen nothing but positive results.  Try it.  You may like it, too.  Let your properties be properties.</p>
<p><b>UPDATE:</b><br />
From reading the comments, I think there was some confusion about what I meant in this post.  I am not talking about using naked properties instead of accessor methods.  I&#8217;m not talking about accessor methods at all in this post.  A specific accessor method, such as<br />
<pre class="php"><span style="color: #0000ff;">$obj</span>-&gt;<span style="color: #006600;">getFoo</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span></pre><br />
where the name of the property is part of the method name is very different than<br />
<pre class="php"><span style="color: #0000ff;">$obj</span>-&gt;<span style="color: #006600;">get</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'foo'</span><span style="color: #66cc66;">&#41;</span>;</pre><br />
Where you pass the name of the property as a string parameter.  Its only the latter pattern, where the property name is an actual parameter to the method, that I am talking about in this post and that I think should generally be refactored.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2007/05/08/let-your-properties-be-properties/feed/</wfw:commentRss>
		</item>
		<item>
		<title>On the Perils of Inline API Documentation</title>
		<link>http://www.procata.com/blog/archives/2007/04/13/on-the-perils-of-inline-api-documentation/</link>
		<comments>http://www.procata.com/blog/archives/2007/04/13/on-the-perils-of-inline-api-documentation/#comments</comments>
		<pubDate>Fri, 13 Apr 2007 15:55:26 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Software Design]]></category>
<category>api design</category><category>api documentation</category><category>docblocks</category><category>phpdocumentor</category>
		<guid isPermaLink="false">http://www.procata.com/blog/archives/2007/04/13/on-the-perils-of-inline-api-documentation/</guid>
		<description><![CDATA[Travis Swicegood has a post questioning the value of the docblock.  I have a deep sympathy with this sentiment.
Even on projects with extensive generated documentation, I find that kind of documentation to be of extremely low value.  The problem with inline API documentation is that there is no sense of priority.  Developers [...]]]></description>
			<content:encoded><![CDATA[<p>Travis Swicegood has a post <a href="http://www.travisswicegood.com/index.php/2007/04/11/programming_languages_are_declarative">questioning the value of the docblock</a>.  I have a deep sympathy with this sentiment.</p>
<p>Even on projects with extensive generated documentation, I find that kind of documentation to be of extremely low value.  The problem with inline API documentation is that there is no sense of priority.  Developers are encouraged to document every element that can possibly be documented. Then, when the documentation is generated, there is no way to distinguish the important from noise.</p>
<p>Another problem is restating the obvious.  When a property or method really is well named, there may not be much more to say in the docblock.  But, the mechanics of docblocks invites the programmer to say it anyway.  So, you end up with comments like &#8220;$widget the widget.&#8221;</p>
<p>Duplication is also a significant problem.  If you inherit from a base class or you implement an interface, there is a tendency to copy and paste the doc block from the parent to the children.  This is an obvious maintenance problem.  In fact, this is one of the major problems with comments.  If comments restate what the code does, its a form of code duplication.  When the code is changed, it requires changes in the comments.  In this sense, comments make code harder to maintain.</p>
<p>Lately, I&#8217;ve been trying to curb the <a href="http://en.wikipedia.org/wiki/Attractive_nuisance_doctrine">attractive nuisance</a> aspect of docblock comments by replacing docblocks with comments like<br />
<pre class="php">&nbsp;
<span style="color: #808080; font-style: italic;">// Definition in parent</span>
&nbsp;</pre><br />
 or<br />
<pre class="php">&nbsp;
<span style="color: #808080; font-style: italic;">// docblock intentionally omitted.</span>
&nbsp;</pre><br />
It would be nice if there were standard abbreviations for things like these.  The idea being to eliminate the attractive nuisance of the commentable element by placing a comment there that is not a docblock, and then commenting only the elements where you have something to say.</p>
<p>Well, if docblocks are so bad, what is the alternative?  Well, I&#8217;ve tried a few, including using a wiki for API documentation.  Here is the problem.  If duplication between the comment and the code is created by inline documentation, that maintenance problem becomes significantly worse with distance.  If the documentation is external to the code, that distance really harms the ability to keep the documentation in sync with the code.  So, docblocks are bad, but everything else is worse.</p>
<p>Docblocks were popularized by Sun and Java (or maybe Donald Knuth).  But when sun was documenting their Java APIs with docblocks, they had a professional documentation team to do the work.  When teams that don&#8217;t have a dedicated documenter role use these tools, I think they fall short.</p>
<p>So what is the solution?  I&#8217;d like to see better techniques and conventions for solving the problems of docblocks: avoiding duplication, avoiding restating the obvious, and avoiding the tendency to docblock everything thats docblockable.  Maybe there are more successful documenters out there who are handling these API documentation anti-patterns better than I am.  I&#8217;d sure like to hear how.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2007/04/13/on-the-perils-of-inline-api-documentation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Problem with Markup Languages</title>
		<link>http://www.procata.com/blog/archives/2007/03/14/the-problem-with-markup-languages/</link>
		<comments>http://www.procata.com/blog/archives/2007/03/14/the-problem-with-markup-languages/#comments</comments>
		<pubDate>Wed, 14 Mar 2007 17:30:14 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Usability]]></category>

		<category><![CDATA[Software Design]]></category>
<category>html markup</category><category>input filtering</category><category>markup languages</category><category>regular expressions</category><category>security</category><category>wiki syntax</category><category>wordpress</category>
		<guid isPermaLink="false">http://www.procata.com/blog/archives/2007/03/14/the-problem-with-markup-languages/</guid>
		<description><![CDATA[Chris Shiflett has a post today, Allowing HTML and Preventing XSS.  The problem is how to allow users to format their contributed content without introducing security vulnerabilities.  The answer is usually some sort of markup language or filtering and sanitization of HTML.
BBCODE was designed for this purpose.  There is no actual standard, [...]]]></description>
			<content:encoded><![CDATA[<p>Chris Shiflett has a post today, <a href="http://shiflett.org/blog/2007/mar/allowing-html-and-preventing-xss">Allowing HTML and Preventing XSS</a>.  The problem is how to allow users to format their contributed content without introducing security vulnerabilities.  The answer is usually some sort of markup language or filtering and sanitization of HTML.</p>
<p>BBCODE was designed for this purpose.  There is no actual standard, but the core syntax seems fairly uniform.  It&#8217;s good for those used to forums, where it seems to norm.</p>
<p>HTML markup is nice because it is a standard, even if varying subsets are supported.  Learning a little HTML isn&#8217;t going to hurt anyone, at least for the next 20 years or so.  The problem is that HTML was never intended to be hand edited.  The syntax is not the most inviting, and different HTML-like markup languages handle whitespace differently than the HTML standard.</p>
<p>Wiki markup syntaxes were designed to be human friendly. The main problem I have with wiki syntax is that there is no standard.  It seems like every wiki has a different way to formulate a link, for example.  I guess there is some progress with <a href="http://www.wikicreole.org/">Wiki Creole</a>, but I still have a bad taste in my mouth.</p>
<p>The other problem I have with wiki markup is that I find it to be non-deterministic.  When I edit any given wiki and try to use more than basic formatting, I never know what I am going to get.  Most of the markup processing engines for these wikis are impenetrable morasses of regular expressions.  It can be hard to gauge interactions.  Are you really sure they are secure?</p>
<p>Speaking of impenetrable morasses of regular expressions, have you ever looked at WordPress&#8217;s input path?  I&#8217;m sure every one with a WordPress blog who likes to blog about PHP code knows that it is a code eater.  I&#8217;ve been particularly disappointed with WordPress in this area.  Most the &#8220;code formatting&#8221; plugins still have problems protecting code from WordPress&#8217; heavy hand.</p>
<p>But the WordPress preg_replace gauntlet doesn&#8217;t just mangle code.  I have a post which has been sitting in draft mode for several weeks because I can&#8217;t figure out how to give it the proper markup.  WordPress is somehow taking my perfectly balanced input markup and producing &#8220;unbalanced&#8221; output markup.  I haven&#8217;t yet tracked down the problem to either submit a fix or to do a good bug report.  Frankly, I&#8217;m not looking forward to trudging through all those regular expressions.</p>
<p>In Chris&#8217; post, he takes the regular expression approach.  Folks in the comments have pointed out a few problems with his approach, including the problem of interleaved tags.  If you can&#8217;t tell by now, I am not a fan of the regular expression gauntlet approach to markup languages.  I prefer a defined syntax and a traditional computer science style parser (which may use regular expressions).</p>
<p>The other must-have is a preview option.  With so much variation in markup languages, not having a preview leaves the user to play Russian roulette with their submitted content.  I&#8217;ve talked about that before in the <a href="http://www.procata.com/blog/archives/2005/03/31/the-usability-of-input-filtering/">usability of input filtering</a>.  This is another area where WordPress leaves the user high and dry.  </p>
<p>The complex input path in WordPress combined with its reliance on global variables seems to leave it unable to do an in-page preview.  The admin area preview is an IFRAME so that it launches a separate request.  The various live preview plugins are JavaScript based and don&#8217;t work when it is disabled.  They also don&#8217;t pass the input through the same input path that WordPress uses, so they are not a true preview.</p>
<p>I don&#8217;t mean for this to be a WordPress rant, on the whole, I like WordPress.  Rather, I just wanted to point out how hard it can be to do good input filtering, that is safe, reliable, deterministic, and usable.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2007/03/14/the-problem-with-markup-languages/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Delphi for PHP</title>
		<link>http://www.procata.com/blog/archives/2007/02/23/delphi-for-php/</link>
		<comments>http://www.procata.com/blog/archives/2007/02/23/delphi-for-php/#comments</comments>
		<pubDate>Fri, 23 Feb 2007 18:55:39 +0000</pubDate>
		<dc:creator>Jeff</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Open Source]]></category>

		<category><![CDATA[Software Design]]></category>
<category>delphi</category><category>delphi for php</category><category>delphi4php</category><category>php</category><category>vcl</category><category>vcl4php</category>
		<guid isPermaLink="false">http://www.procata.com/blog/archives/2007/02/23/delphi-for-php/</guid>
		<description><![CDATA[I have to comment on this week&#8217;s annoucement of Delphi for PHP.  I was a Delphi programmer for about 5 years before taking up PHP about 6 years ago.  What a convergence.
I have a great fondness and respect for the old Object Pascal based Delphi.  Delphi&#8217;s VCL has been influential, inspiring the [...]]]></description>
			<content:encoded><![CDATA[<p>I have to comment on this week&#8217;s annoucement of <a href="http://www.codegear.com/Products/Delphi/DelphiforPHP/tabid/237/Default.aspx">Delphi for PHP</a>.  I was a Delphi programmer for about 5 years before taking up PHP about 6 years ago.  What a convergence.</p>
<p>I have a great fondness and respect for the old Object Pascal based Delphi.  Delphi&#8217;s VCL has been influential, inspiring the GUI components in Java.  And, of course <a href="http://en.wikipedia.org/wiki/Anders_Hejlsberg">Ander Heijlsberg</a> went on to put a huge stamp on C# and .NET that would be familiar to any Delphi programmers.</p>
<p>I&#8217;ve always admired this approach of extending the language syntax to make common things easy and for the integration between the language and the tools. In Delphi, this was evidenced by the excellent properties support.  Six years later, this is the feature I miss the most in PHP.  This language extension approach has seen its culmination in C# and <a href="http://msdn2.microsoft.com/en-us/netframework/aa904594.aspx">LINQ</a>.  It almost pains me to say it, but the cutting edge of commercial language design is at Microsoft now.</p>
<p>On the other hand, I&#8217;ve never had that much respect for Borland as a company. We were big enough to have Borland representative&#8217;s come to our office and try sell us their products.  They were terrible at the mechanics of selling into big companies.  I was in their beta programs.  I went to their conferences.  I&#8217;ve never had any sense that they know what they are doing business wise.  Inprise?  What were they thinking?  Now here they are, just having gotten their asses kicked by eclipse in the Java IDE space and what are they working on?  They release an IDE for PHP, just as Zend is embracing Eclipse in the PHP space.  Brilliant!</p>
<p>I don&#8217;t quite know what Delphi means now.  To me, its always been and IDE plus Object Pascal.  What is it now? I also don&#8217;t quite know what Borland has become.  Is it <a href="http://www.codegear.com/">CodeGear</a> now?  I guess that the Delphi for PHP IDE comes from <a href="http://www.qadram.com/">Quadram</a> and their now discontinued QStudio product.  And the VCL is their WCL (no linkage found).  Anytime I&#8217;ve been touched by the corporate entity that was Borland, confusion ensued.  I&#8217;m confused now.</p>
<p>It appears that the <a href="http://sourceforge.net/projects/vcl4php">PHP version of the VCL</a> will be released on open source.  There is nothing at the sourceforge project, yet, but I&#8217;ll be interested to see what it looks like, if only for old times sake.</p>
<p>The Delphi tool approach was to serialize an object based representation of an application, then offer tools to create that serialized representation, and to load that representation at run time.  In Delphi, that serialization was done into the form files (.DFM).  I&#8217;ll be interested to see how Delphi for PHP does it.  Perhaps, this is an area where the <a href="http://www.zend.com/pdt">Eclipse PHP Development Tool</a> can learn. I know that I definitely had Delphi in mind when I was writing my column  on <a href="http://www.phparch.com/issue.php?mid=98">Object Serialization</a> for this month&#8217;s php | Architect.</p>
<p>Meanwhile, if you want to see the Delphi influence in PHP with code that you can download today, take a look at the <a href="http://www.xisc.com/">Prado</a> framework, which I imagine to be like the VCL for PHP, but without the supporting IDE.</p>
<p>This is a space I&#8217;ll definitely be watching.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.procata.com/blog/archives/2007/02/23/delphi-for-php/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
