<?xml version="1.0" encoding="UTF-8"?>
<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/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>experimentalworks &#187; PHP</title>
	<atom:link href="http://blog.experimentalworks.net/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.experimentalworks.net</link>
	<description></description>
	<lastBuildDate>Wed, 14 Jul 2010 15:35:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>php-trunk macport</title>
		<link>http://blog.experimentalworks.net/2010/05/php-trunk-macport/</link>
		<comments>http://blog.experimentalworks.net/2010/05/php-trunk-macport/#comments</comments>
		<pubDate>Mon, 24 May 2010 15:48:39 +0000</pubDate>
		<dc:creator>dsp</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[dtrace]]></category>

		<guid isPermaLink="false">http://blog.experimentalworks.net/?p=435</guid>
		<description><![CDATA[macports is a widely used ports system for Mac OS. It's [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.macports.org/ ">macports</a> is a widely used ports system for Mac OS. It&#8217;s repository contains hundreds of application that can be compiled and installed. The repository contains php 5.3. So if you want to run PHP from subversion you still have to compile it yourself and install it yourself outside your managed ports environment. I created a rather simple Portfile to build it from PHP&#8217;s <a href="http://svn.php.net/repository/php/php-src/trunk/">trunk</a>. </p>
<p>To use the php-trunk portsfile. Just extract the tarball into a directory and&#8230;<br />
<code><br />
 $ tar xzvf php-trunk-port.tar.gz<br />
 $ cd php-trunk-port<br />
<del datetime="2010-05-24T18:23:38+00:00"> $ echo "file://`pwd`" > /opt/local/etc/macports/sources.conf</del><br />
 $ echo "file://`pwd`" >> /opt/local/etc/macports/sources.conf<br />
 $ port install php-trunk<br />
</code></p>
<p>And the best thing about the port: It compiles PHP with dtrace support :).</p>
<p>Please note the Portfile is very simple and is not tested with the additional modules provided by macports. So use it at your own risk and enhance it.</p>
<p><a href="http://patches.experimentalworks.net/php-trunk-port.tar.gz">DOWNLOAD</a></p>
<p>UPDATE: as philip noted, it should be >> instead of >.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.experimentalworks.net/2010/05/php-trunk-macport/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Writing a simple PHP sourcecode buildscript in Scala</title>
		<link>http://blog.experimentalworks.net/2010/01/writing-a-simple-php-source-buildscript-in-scala/</link>
		<comments>http://blog.experimentalworks.net/2010/01/writing-a-simple-php-source-buildscript-in-scala/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 22:48:22 +0000</pubDate>
		<dc:creator>dsp</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[scala]]></category>

		<guid isPermaLink="false">http://blog.experimentalworks.net/?p=356</guid>
		<description><![CDATA[Scala is a fascinating language. Running on the Java VM [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.scala-lang.org">Scala</a> is a fascinating language. Running on the <a href="http://java.com">Java VM</a>, Scala offers a powerful mixture from both the imperative Java world and functional programming including modern techniques like <a href="http://www.scala-lang.org/node/242">Actors</a>. Personally I prefer to not just learn programming languages, but also try them out while reading through the book.</p>
<p>As I wanted to have nice a build system for my <a href="http://php.net">PHP</a> <a href="http://svn.php.net">subversion</a> checkout, I used this need as a project to start coding Scala. So what do I exactly need? I want to build multiple versions of PHP from the same branch without checking out the code twice. I also want to configure these builds somewhere without always typing in the parameter list or so. For further versions I want to be able to configure these in a file that can easily be distributed to other machines.</p>
<p>I set down and wrote a parser for a configuration file that can configured build targets which is then build by<br />
the program. The configuration file I used is specialized for this purpose, which is why I didn&#8217;t used something like ant or so. The result is called <strong><a href='http://blog.experimentalworks.net/wp-content/uploads/2010/01/bauaffe-3.0.0a1.jar'>bauaffe-3.0.0a1.jar</a></strong>.</p>
<p>I&#8217;ll just show a few things done in the project, but mainly focus on what the nice script can do. Further blog posts will be about the actual implementation.</p>
<p>The configuration looks like this</p>
<pre>
$ cat ~/.buildmaker
begin default configuration
    define source "/Users/dsp/dev/c/php-src"
    define build "/Users/dsp/dev/c/php-src/build"
    define defaults as
        with "iconv=/opt/local"
    build trunk as
        "php60" using defaults
        "php60-debug" using defaults
            enable "debug"
    build branch "PHP_5_3" as
        "php53" using defaults
            environment PHP_AUTOCONF="autoconf213"
        "php53-debug" using defaults
            enable "debug"
            environment PHP_AUTOCONF="autoconf213"
</pre>
<p>.<br />
Proper indention is not necessary (as e.g in python).</p>
<hr />
You might want to think that parsing the configuration file can be difficult. Well, if you use C you would use YACC, if you use PHP, I don&#8217;t know what you would have done, but Scala is made to create this kind of Domain Specific Languages (for my the config is a DSL). You can easily transform a EBNF directly to scala code using the JavaTokenParsers provided by the Scala Library. As an example this it the statement that parses the first line:<br />
<code><br />
    def begin : Parser[Configuration] =<br />
        "begin" ~ ("default" | stringLiteral) ~ "configuration" ~ rep(define | build) ^^ {<br />
        case "begin"~name~"configuration"~confs => new Configuration(name, confs)<br />
    }<br />
</code><br />
which is directly taken from the BNF:<br />
<code><br />
      config ::= "begin" ( "default" | string ) "configuration" ( define | build )*<br />
</code></p>
<p>Did I mention that the actual parser is 170 lines of code with usual indention and formatting?</p>
<hr />
<p><strong>Configuration</strong><br />
The configuration file is searched in <i>~/.buildmaker</i>, or if <i>~/.builmaker</i> doesn&#8217;t exists, <i>buildmaker.conf</i> in the current directory. How do you configure the tool? First of all you can specify a configuration. It is usually called &#8220;default&#8221;. It is not yet supported to name it differently, although the parser is able to parse it. In further versions multiple configurations per file are allowed.</p>
<p><strong>Variables</strong><br />
Variables are set using the <i>define</i> syntax. At the moment you can set the <i>build</i> and <i>source</i> variable as well the <em>defaults</em> variable, which is usually a block of statements that can be used in the branch configurations. </p>
<p><strong>Branches</strong><br />
A branch is configured using the <em>build</em> syntax. You first have to specify which branch to build. Every branch can then configured to have build target with a given set of options. Branch options are:</p>
<ul>
<li>with <em>string</em>: Builds the target with the given extension</li>
<li>enable <em>string</em>: Builds the target with the given extension</li>
<li>environment <em>string=string</em>: Builds the target with environment variable</li>
</ul>
<p>. You can specify <i>using defaults</i> which will cause the runner to use the options specified in the <i>defaults</i> define.</p>
<p><em>At the moment the parser will not do a good job in notifying you what you are allowed to do and what not, although pure parse error will be emitted. You can also not set any other variable than the described once.</em></p>
<p><strong>Building</strong><br />
Calling</p>
<pre>
$ java -jar bauaffe-3.0.0a1.jar list
TARGET                         LAST BUILD
php60                          None
php60-debug                    None
php53                          Sat Jan 09 16:55:12 CET 2010
php53-debug                    Sat Jan 09 16:59:37 CET 2010
</pre>
<p>gives you a list of parsed targets and their last build date. You can build a target using</p>
<pre>
$ java -jar bauaffe-3.0.0a1.jar <targetname>
</targetname></pre>
<p>or build all using</p>
<pre>
$ java -jar bauaffe-3.0.0a1.jar all
</pre>
<p>Please notice that the current version requires that you now what you are doing. You might miss some error messages or find them not useful. I&#8217;ll change this before the first release, if I&#8217;ll do a final version of it. I hope you like the little tool.</p>
<p><a href='http://blog.experimentalworks.net/wp-content/uploads/2010/01/bauaffe-3.0.0a1.jar'>Download It!</a></p>
<p><em>Scala (pronounced /ˈskɑːlə, ˈskeɪlə/) is a multi-paradigm programming language designed to integrate features of object-oriented programming and functional programming.[1] The name Scala stands for &#8220;scalable language&#8221;, signifying that it is designed to grow with the demands of its users.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.experimentalworks.net/2010/01/writing-a-simple-php-source-buildscript-in-scala/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Calling Conventions &#8211; when you need to know C to understand PHP</title>
		<link>http://blog.experimentalworks.net/2009/07/calling-conventions-when-you-need-to-know-c-to-understand-php/</link>
		<comments>http://blog.experimentalworks.net/2009/07/calling-conventions-when-you-need-to-know-c-to-understand-php/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 16:26:59 +0000</pubDate>
		<dc:creator>dsp</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[gcc]]></category>

		<guid isPermaLink="false">http://blog.experimentalworks.net/?p=260</guid>
		<description><![CDATA[I think most of the people using PHP wonder from time t [...]]]></description>
			<content:encoded><![CDATA[<p>I think most of the people using PHP wonder from time to time about particular behavior of the language. That&#8217;s pretty much the same case with every language. Pythoneers have their <em>wtf</em> moments, Ruby programmers have their wtf moments and C programmers tend to live in a whole wtf universe. But lately I stumbled over a nice one. It looked like a bug in PHP, but turns out to be an interesting, curious, part of the C-language. Imagine the following PHP code sample and note that $a and $b are not defined (yeah I know, it&#8217;s bad coding style..blabla..):<br />
<code><br />
&lt;?php<br />
var_dump($a + $b);<br />
?&gt;<br />
</code><br />
What is the expected result with error_reporting set to E_ALL?<br />
<code><br />
PHP Notice: Undefined variable: b in /var/foo/bla on line 1<br />
PHP Notice: Undefined variable: a in /var/foo/bla on line 1<br />
</code>.<br />
Are you sure? I&#8217;m not. On x86 hardware b is fetched before a is fetched and therefore the executor detects that b is not set first. But wait. Let&#8217;s test this on a SPARC machine:<br />
<code><br />
PHP Notice: Undefined variable: a in /var/foo/bla on line 1<br />
PHP Notice: Undefined variable: b in /var/foo/bla on line 1<br />
</code>.<br />
What? It evaluates it in the reversed oder? What is happening? So I spend a few minutes with my lovely debugger and it turns out that this is what happens in the engine (I use pseudo code here):</p>
<pre>
result ZEND_ADD_OPCODE()
{
   return add_function(get_op1(), get_op2());
}
</pre>
<p>Voila, that&#8217;s the problem. On SPARC get_op1() is executed before get_op2(), while it&#8217;s the other way round on x86. As get_opX() detects if a variable exists, the error messages appear in reversed oder. I did a little bit research (thank you <a href="http://developers.sun.com/sunstudio/">SunCC Team</a> for your answer!) and it turned out, that <a href="http://en.wikipedia.org/wiki/C99">C99</a> doesn&#8217;t define the way function calls in parameter lists are executed. Therefore, every system and compiler is free to use it&#8217;s own ordering mechanism. My current plan: Write a compiler that does this by random(). The fix is trivial:</p>
<pre>
result ZEND_ADD_OPCODE()
{
  op2 = get_op2();
  return add_function(get_op1(), op2);
}
</pre>
<p>. It&#8217;s a lovely curiosity.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.experimentalworks.net/2009/07/calling-conventions-when-you-need-to-know-c-to-understand-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DTracing PHP</title>
		<link>http://blog.experimentalworks.net/2008/12/dtracing-php/</link>
		<comments>http://blog.experimentalworks.net/2008/12/dtracing-php/#comments</comments>
		<pubDate>Sat, 20 Dec 2008 01:22:09 +0000</pubDate>
		<dc:creator>dsp</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[dtrace]]></category>
		<category><![CDATA[opensolaris]]></category>

		<guid isPermaLink="false">http://wp.experimentalworks.net/?p=83</guid>
		<description><![CDATA[Dtrace is an extremely flexible and powerful tool to tr [...]]]></description>
			<content:encoded><![CDATA[<p>Dtrace is an extremely flexible and powerful tool to trace and debug applications. I recently dtraced PHP a little bit, so here is a tutorial how to start dtracing PHP.<br />
<span id="more-83"></span><strong>Prequisites</strong><br />
You need a dtrace capable operating system like Solaris 10, OpenSolaris, Mac OS X 10.5 or FreeBSD 7. I use dtrace on OpenSolaris 2008.11. You also need at least dtrace privileges or need to be root to be able to trace a program. I used PHP 5.3.0alpha3 in my tests, but it actually doesn&#8217;t matter. As PHP doesn&#8217;t provide DTrace probes itself we have to trace the underlying C-functions, therefore we need to know the Zend Engine and PHP&#8217;s internals.</p>
<p><strong>An Introduction into DTrace</strong><br />
Dtrace is really powerful and trying to do an introduction to all it&#8217;s features is just not possible. Therefore I will just focus on the basics, that are needed to get our stuff working. The basic idea behind Dtrace is that the kernel and userland programs fire probes on a specific location in the kernel or the userland program. As the probe is just fired if DTrace is running and trying to catch those <i>markers</i>, the probes itself don&#8217;t cost CPU power at all (in fact they are NOP&#8217;s). But if we trace them, we are able to see those probes and they are able to pass some data. To get way more complex information out of those probes, DTrace has an builtin scripting language that catches those probes and process them.</p>
<p><em>Dtrace program structure</em><br />
Every probe in DTrace is describe by a 4 tuple. The first one is the so-called provider. The second, the probemodule, the third is the probefunc and the last one is the probename. The parts are separated by a semicolon, therefore every probe is defined by: </p>
<blockquote><p>
&lt;probeprovider&gt;:&lt;providermodule&gt;:&lt;probefunc&gt;:&lt;probename&gt;
</p></blockquote>
<p>In our example, the provider will usually the pid provider that gives us probes for a given PID (the PHP controller we want to trace). The probemodule will be <i>php</i> and the probefunc will be the function name of the underlying C-function. The name can actually be everything but it is best-practice to have a probe at the entry of a function, called <i>entry</i> and <i>return</i>just before the function returns. A DTrace program have an probe identifier that matches a probe. Every identifier has a body that can contain initialization of variables or accumulation of data using a table. Also, every identifier can have a condition that is evaluated before the body is run. So we have the following structure:</p>
<blockquote><p>
&lt;probeprovider&gt;:&lt;providermodule&gt;:&lt;probefunc&gt;:&lt;probename&gt;<br />
/ &lt;condition&gt; /<br />
{<br />
    &lt;body&gt;<br />
}
</p></blockquote>
<p>As an example, we trace gc_collect_cylce function:</p>
<blockquote><p>
pid$target:php:gc_collect_cycle_function:entry<br />
{<br />
    trace(probename);<br />
}
</p></blockquote>
<p>Please notice that DTrace features a lot predefined variables, such as <i>probename</i>. Please refer to Sun&#8217;s Dtrace Guide to get a list of predefined variables.</p>
<p><em>PHP probes</em><br />
<strike>As PHP doesn&#8217;t provide own probes we have to use the underlying C-functions.</strike> PHP itself doesn&#8217;t provide own probes. There is ext/dtrace written by Wez Furlong which gives PHP some probes, but as we want to get a little bit deeper, we have to use the underlying C-functions. Userland programs are usually traced by the so-called pid-provider. It&#8217;s used to get all probes by a program with a given PID. Unlike userland programs, the kernel doesn&#8217;t have a pid, therefore kernel probes do not have a PID and can be identified easily be an unique name. As we sometimes do not know the PID of the php process that we want to trace, there is a variable called $target. If yo use it, $target will be automatically filled with the PID that was created when dtrace started the program. If I start a program with <i>dtrace -s test.d -c &#8216;php test.php&#8217;</i> the programm <i>php test.php</i> will be executed and the created PID will be assigned to the variable $target. DTrace also have an option just to display the available probes: Try <i>dtrace -ln &#8216;pid$target:php::entry&#8217; -c &#8216;php test.php&#8217;</i> to get all function entries called by PHP. You might from time to time a get a message that not enough memory was available to trace.  In those cases you just tried to capture too much probes. Therefore, I used the specific :::entry notation to just get function entries, which worked fine on my machine. So let&#8217;s take look at some interesting probes. If we just try to display all probes related to PHP with <i>dtrace -ln &#8216;pid$target:php::entry&#8217; -c &#8216;php test.php&#8217;</i>.<br />
The output might start with something like:</p>
<blockquote><p>
   ID   PROVIDER            MODULE                          FUNCTION NAME<br />
69608    pid2696               php                            _start entry<br />
69609    pid2696               php                             __fsr entry<br />
69610    pid2696               php                  _free_ereg_cache entry<br />
69611    pid2696               php                   zm_startup_ereg entry<br />
69612    pid2696               php                  zm_shutdown_ereg entry<br />
69613    pid2696               php                      zm_info_ereg entry<br />
69614    pid2696               php                          zif_ereg entry<br />
69615    pid2696               php                         zif_eregi entry<br />
69616    pid2696               php                  php_ereg_replace entry<br />
69617    pid2696               php                  zif_ereg_replace entry<br />
69618    pid2696               php                 zif_eregi_replace entry<br />
69619    pid2696               php                         zif_split entry<br />
69620    pid2696               php                        zif_spliti entry<br />
69621    pid2696               php                   zif_sql_regcase entry<br />
69622    pid2696               php                       php_regcomp entry<br />
69623    pid2696               php                             p_ere entry<br />
69624    pid2696               php                         p_ere_exp entry<br />
69625    pid2696               php                             p_str entry<br />
69626    pid2696               php                             p_bre entry<br />
69627    pid2696               php                         p_simp_re entry
</p></blockquote>
<p><strong>First example</strong><br />
So our first example will be that we want to trace the compilation time. The compile function is called compile_file in PHP. Therefore our probe identifier would be <i>pid$target:php:compile_file</i>. The PID provider will just get the probes for a specific probe, while the php probemodule will focus on all PHP related functions. We then select the compile_file function. Provided by the kernel, there are two probenames, calle <i>entry</i> and . Entry is called when the function is entered and return, when the function returns. So we need to trace <i>pid$target:php:compile_time:entry</i> and pid$target:php:compile_time:return. We know just have to get information how long the compilation takes. For that purpose DTrace defines a variable called <i>timestamp</i> that is accessible within the body of an DTrace identifier which holds the milliseconds from the beginning of a program. So know we catch our entry probe and set the time to a local value:</p>
<blockquote><p>
pid$target:php:compile_file:entry<br />
{<br />
   self->compile_start = timestamp;<br />
}
</p></blockquote>
<p>Note that the <i>self-></i> notation is used to get a per-thread variable. Therefore every thread would have it&#8217;s own value. It&#8217;s not particularly necessary for our PHP based example, but it is best-practice to use thread-local variables whenever possible.</p>
<p>We just need our return probe that calculates the real offset:</p>
<blockquote><p>
pid$target:php:compile_file:return<br />
{<br />
  printf(&#8220;Compile time: %dn&#8221;, timestamp &#8211; self->compile_start);<br />
}
</p></blockquote>
<p>This will output our actual compile time. Just put both identifiers and their bodies into &#8216;compiletime.d&#8217; and start dtrace with <i>dtrace -q -s compiletime.d -c &#8216;php test.php&#8217;</i> and it will display you the compilation time of test.php. Please notice that both self->compile_start and timestamp are integers. Dtrace in fact doesn&#8217;t have the notion of a float primitive, so you would not be able to output a float using printf.</p>
<p>The output might be similar to:</p>
<blockquote><p>
$ dtrace -q -s compiletime.d -c &#8216;php test.php&#8217;<br />
Compile Time: 99604
</p></blockquote>
<p><strong>Advcanced Example</strong><br />
Now let&#8217;s get a little bit deeper into the engine. We now want to trace when the garbage collector hit&#8217;s in and want to see the amount of freed refs. The garbage collector uses the function gc_collect_cycles.</p>
<blockquote><p>
pid$target:php:gc_collect_cycles:return<br />
{<br />
   printf(&#8220;%d refs freed&#8221;, arg1);<br />
}
</p></blockquote>
<p>Please notice the special arg1 variable. This always holds the return value in &#8220;return&#8221; probenames. In &#8220;entry&#8221;, arg0&#8230;argN will hold the function parameters.</p>
<p>For more detailed examples, see my next blog entry, which will contain more sophisticated DTrace scripts.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.experimentalworks.net/2008/12/dtracing-php/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Compiling PHP under OpenSolaris</title>
		<link>http://blog.experimentalworks.net/2008/09/compiling-php-under-opensolaris/</link>
		<comments>http://blog.experimentalworks.net/2008/09/compiling-php-under-opensolaris/#comments</comments>
		<pubDate>Tue, 30 Sep 2008 01:17:37 +0000</pubDate>
		<dc:creator>dsp</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[opensolaris]]></category>

		<guid isPermaLink="false">http://wp.experimentalworks.net/?p=75</guid>
		<description><![CDATA[As I switched my main system recently from Linux to Ope [...]]]></description>
			<content:encoded><![CDATA[<p>As I switched my main system recently from Linux to OpenSolaris I compiled PHP. Quiet obvious things are a little bit different on Solaris. The usual <em>./buildconf &#038;&#038; ./configure &#038;&#038; make install</em> doesn&#8217;t work anymore. The good news: It&#8217;s not much harder. Let&#8217;s start to get the prequisites:<br />
<span id="more-75"></span></p>
<blockquote><p>
~$ su<br />
~# pkg install SUNWgm4 SUNWaconf SUNWgmake SUNWgcc SUNWbison
</p></blockquote>
<p>Finally we have to get the latest re2c sources. Re2c is needed to regenerate PHPs parsers but not yet available in OpenSolaris official package repository. So go to <a href="http://sourceforge.net/projects/re2c" target="_blank">re2c at sourceforge</a> and download the most recent sources.</p>
<blockquote><p>
~$ gtar xzvf re2c-0.13.5.tar.gz<br />
~$ cd re2c-0.13.5/<br />
~$ ./configure<br />
~$ gmake
</p></blockquote>
<p>The other necessary GNU tools should be installed, otherwise try to install SUNWgnu-coreutils. So let&#8217;s get our CVS snapshot and compile it:</p>
<blockquote><p>
~$ cd php-src-5.3/<br />
~$ MAKE=gmake ./buildconf<br />
~$ ./configure RE2C=&#8221;~/dev/c/re2c-0.13.5/re2c&#8221;<br />
~$ gmake<br />
~$ su<br />
~# gmake install
</p></blockquote>
<p>As we have to use GNUs make and not Solaris make implementation we have to set the <b>MAKE</b> environment variable used by buildconf. Since re2c is not in our path (we didn&#8217;t installed it), we pass the location of the <i>re2c</i> executable to the configure script with the <b>RE2C</b> env variable. After successfully executing gmake install, we have our PHP 5.3 installed.</p>
<blockquote><p>
~$ php -v<br />
PHP 5.3.0alpha3-dev (cli) (built: Sep 30 2008 02:37:10)<br />
Copyright (c) 1997-2008 The PHP Group<br />
Zend Engine v2.3.0, Copyright (c) 1998-2008 Zend Technologies
</p></blockquote>
<p>Please notice that PHP&#8217;s default configuration is to install the binaries in <i>/usr/local/bin</i>. This directory is usually not in $PATH, so update your PATH.</p>
<p><strong>UPDATE</strong><br />
As pointed out in the <a href="http://opensolaris.org/jive/thread.jspa?threadID=76826&#038;tstart=0" target="_blank">OpenSolaris Forums</a> GNU make is just required for the buildconf step, so you should be able to use Solaris make implementation if you don&#8217;t compile from CVS sources.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.experimentalworks.net/2008/09/compiling-php-under-opensolaris/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extension development on windows</title>
		<link>http://blog.experimentalworks.net/2008/08/extension-development-on-windows/</link>
		<comments>http://blog.experimentalworks.net/2008/08/extension-development-on-windows/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 10:32:00 +0000</pubDate>
		<dc:creator>dsp</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://wp.experimentalworks.net/?p=76</guid>
		<description><![CDATA[When it comes to choose a operating system to run PHP a [...]]]></description>
			<content:encoded><![CDATA[<p>When it comes to choose a operating system to run PHP applications often <a href="http://kernel.org" >Linux</a> is the choice. <a href="http://www.php.net" >PHP</a>, it&#8217;s buildsystem and it&#8217;s <a href="http://pecl.php.net" >extensions</a> are developed and optimized to run under Linux (and Unices). There are several reasons that Linux is the better supported operating system. Maybe due to historical reasons, maybe most of the core developers work und Linux (rumours were afloat that this is not quite true) or maybe just because the extensions finally run on a Linux server, so therefore it only counts if it runs under the target system.</p>
<p>This is actually the reason to not even try to compile my <a href="http://pecl.php.net/package/KTaglib/" >ktaglib</a> extensions under Windows. Well but this approach is doomed to fail as most of the developers out there use Windows as their operating system. Therefore they are not able to run the extension and might not be able to ingerate your extension into their application. So actually I ended up <a href="http://en.wikipedia.org/wiki/Booting" >booting</a> up <a href="http://www.microsoft.com/Germany/windows/default.mspx" >windows</a> again (well after searching for the harddisk that contains a running windows) and try to compile it. Otherwise my fellow collegues wouldn&#8217;t be able to fix my buggy PHP code.</p>
<p>I remember compiling extensions under Windows a year ago, which actually doesn&#8217;t seems to be very easy for me. Since then a lot changed. Ongoing <a href="http://pecl2.php.net" >pecl2</a> efforts from <a href="http://blog.thepimp.net/" >Pierre</a> with great help from <a href="http://elizabethmariesmith.com/" >Elizabeth</a> and Rob now makes compiling on Windows without deeper knowledge about the Windows buildsystem easy. They carry together various <a href="http://wiki.php.net/internals/windows/libs" >notes</a> about the build dependencies in the <a href="http://wiki.php.net" >official php wiki</a>. Furthermore Elizabeth <a href="http://screencast.com/t/lSIaPpkLG" >recorded a video</a> showing how to compile PHP on windows in a few minutes. So I actually ended up going to the pecl2.php.net page and just get the necessary libraries, put them into the right directory and compile PHP the same way as under Linux.</p>
<p>This helped to actually get ktaglib running under Windows. Just take the <a href="http://developer.kde.org/~wheeler/taglib.html#windows" >taglib</a> windows port from the taglib website and compile your windows ktaglib using the PHP windows build system. Maybe the new scripts from the <a href="http://cvs.php.net/viewvc.cgi/php-internals-win/" >php-internals-win</a> repository, that Pierre recently commited, help you to get you way through. It&#8217;s really amazing to concentrate on the work and not trying to get a buildsystem working.</p>
<p><i>ktaglib is a PHP binding for KDE&#8217;s taglib that helps you to read id3 tags and audio information from MP3s or OGGs. The current version is 0.0.1a1 and can be downloaded at <a href="http://pecl.php.net/package/KTaglib/" >http://pecl.php.net/package/KTaglib</a></i></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.experimentalworks.net/2008/08/extension-development-on-windows/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>getopt and longopts in PHP 5.3+</title>
		<link>http://blog.experimentalworks.net/2007/10/getopt-and-longopts-in-php-53/</link>
		<comments>http://blog.experimentalworks.net/2007/10/getopt-and-longopts-in-php-53/#comments</comments>
		<pubDate>Wed, 03 Oct 2007 23:18:01 +0000</pubDate>
		<dc:creator>dsp</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://wp.experimentalworks.net/?p=36</guid>
		<description><![CDATA[In the upcoming PHP 5.3+, the getopt() function will fi [...]]]></description>
			<content:encoded><![CDATA[<p>In the upcoming <a href="http://news.php.net/php.internals/32451" >PHP 5.3+</a>, the <a href="http://docs.php.net/manual/en/function.getopt.php" >getopt()</a> function will finally be available on <a href="http://www.microsoft.com/windows" >Windows</a> systems. Furthermore getopt() will support longopts on every system. To support this feature we <a href="http://news.php.net/php.cvs/46396" >moved</a> the generic getopt function used by the PHP cli/cgi interpreter itself to main/ and recode getopt() to use this function.</p>
<p>Thanks for Jani to review and commit my patch.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.experimentalworks.net/2007/10/getopt-and-longopts-in-php-53/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
