<?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> &#187; php</title>
	<atom:link href="http://blog.kfirbreger.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.kfirbreger.com</link>
	<description></description>
	<lastBuildDate>Tue, 24 Jan 2012 09:47:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Getting session ID in Drupal 6</title>
		<link>http://blog.kfirbreger.com/2010/02/25/getting-session-id-in-drupal-6/</link>
		<comments>http://blog.kfirbreger.com/2010/02/25/getting-session-id-in-drupal-6/#comments</comments>
		<pubDate>Thu, 25 Feb 2010 20:49:22 +0000</pubDate>
		<dc:creator>Kfir</dc:creator>
				<category><![CDATA[guide]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.kfirbreger.com/?p=257</guid>
		<description><![CDATA[Drupal saves its sessions in the sessions table. One can always query they table to get the session ID. There is however a faster way. If the user is logged it, the session id can be found with the following code: global $user; $user->sid; In any case the session id can also be read from [...]]]></description>
			<content:encoded><![CDATA[<p>
Drupal saves its sessions in the sessions table. One can always query they table to get the session ID. There is however a faster way.<br />
If the user is logged it, the session id can be found with the following code:</p>
<pre>
global $user;
$user->sid;
</pre>
<p><span>In any case the session id can also be read from the cookie:</span></p>
<pre>
$_COOKIE[session_name()];
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.kfirbreger.com/2010/02/25/getting-session-id-in-drupal-6/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Theming a form in Drupal 6</title>
		<link>http://blog.kfirbreger.com/2010/02/23/theming-a-form-in-drupal-6/</link>
		<comments>http://blog.kfirbreger.com/2010/02/23/theming-a-form-in-drupal-6/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 11:07:19 +0000</pubDate>
		<dc:creator>Kfir</dc:creator>
				<category><![CDATA[Me]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[form api]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[theming]]></category>

		<guid isPermaLink="false">http://blog.kfirbreger.com/2010/02/23/theming-a-form-in-drupal-6/</guid>
		<description><![CDATA[Form theming in drupal 6 is quite flexible. One of the nicest tricks is the ability to theme the form in stages. Calling drupal_render on a part of the form will not only return the rendered version of it, but it will also mark that part as rendered so that when you call the final [...]]]></description>
			<content:encoded><![CDATA[<p>Form theming in drupal 6 is quite flexible. One of the nicest tricks is the ability to theme the form in stages. Calling drupal_render on a part of the form will not only return the rendered version of it, but it will also mark that part as rendered so that when you call the final drupal_render over the whole form, it will not re-render the parts already rendered.</p>
<p>Remember that in order for the form to function correctly there are some hidden fields in every form that must be added to the form. Also drupal needs to generate the form tag. Therefore it is my advise, after doing the custom rendering of the parts you want, add a general render of the form. this will reduce the chance of problems with form submission.</p>
<p>Special thanks to Rolf van de Krol, for this tip.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kfirbreger.com/2010/02/23/theming-a-form-in-drupal-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to truly disable drupal cache</title>
		<link>http://blog.kfirbreger.com/2009/05/29/how-to-truly-disable-drupal-cache/</link>
		<comments>http://blog.kfirbreger.com/2009/05/29/how-to-truly-disable-drupal-cache/#comments</comments>
		<pubDate>Fri, 29 May 2009 10:26:05 +0000</pubDate>
		<dc:creator>Kfir</dc:creator>
				<category><![CDATA[guide]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[hacks]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.kfirbreger.com/?p=168</guid>
		<description><![CDATA[Drupal, like most CMSes uses cache intensively to speed things up. In a production site that is exactly what you what. However when developing, cache can cause you much pain. If your an expert in drupal you probably already realized when you need to clear the cache in order to see changes and when not [...]]]></description>
			<content:encoded><![CDATA[<div>
<p>
Drupal, like most CMSes uses cache intensively to speed things up. In a production site that is exactly what you what. However when developing, cache can cause you much pain.</p>
</div>
<div>
<p>
If your an expert in drupal you probably already realized when you need to clear the cache in order to see changes and when not too. the developer module even makes it quite easy to do. However for me, and I am quite sure to quite a lot of other people it is not that clear.
</p>
</div>
<div>
<p>&#8220;Wait&#8221;, you might say. &#8220;Drupal has a disable cache setting&#8221;. You would be right to say that. Only it doesn&#8217;t completely disable the cache, only part of the cache, namely the page caching. To truly disable cache you need to do a bit of a hacking to the cache code. Yes I know they say to never hack core (cache is part of the core drupal release). for me this was worth it. I figure as long as you remember its there and don&#8217;t use it in production you should be fine. The following piece of code needs to be added in <code>include/cache.inc</code>. There are two functions there that you need to edit:</p>
<ul>
<li><code>cache_get</code></li>
<li><code>cache_set</code></li>
</ul>
<p>In <code>cache_get</code> place the code right after the <code>global $user</code>. In <code>cache_set</code>  place it at the start of the function. Here is the code that you need to add.<br />
<code><br />
if(variable_get('cache', CACHE_DISABLED) == CACHE_DISABLED) {<br />
    return 0;<br />
}<br />
</code><br />
Kudos for this hack goes to Rolf van de Krol. Cheers mate.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.kfirbreger.com/2009/05/29/how-to-truly-disable-drupal-cache/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Installing Apache2, PHP5 and MySQL5 on OS X Tiger</title>
		<link>http://blog.kfirbreger.com/2009/05/04/installing-apache2-php5-and-mysql5-on-os-x-tiger/</link>
		<comments>http://blog.kfirbreger.com/2009/05/04/installing-apache2-php5-and-mysql5-on-os-x-tiger/#comments</comments>
		<pubDate>Mon, 04 May 2009 19:45:50 +0000</pubDate>
		<dc:creator>Kfir</dc:creator>
				<category><![CDATA[guide]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[os x]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.kfirbreger.com/?p=105</guid>
		<description><![CDATA[Tiger comes bundled with Apache 1.3 and PHP4. While these are still used for web development they are defenetly on the way out. For this reason I have decided to set up a more up to date MAMP installation on my old Powerbook G4. While this was all done on Tiger, it will most likely [...]]]></description>
			<content:encoded><![CDATA[<p>Tiger comes bundled with Apache 1.3 and PHP4. While these are still used for web development they are defenetly on the way out. For this reason I have decided to set up a more up to date MAMP installation on my old Powerbook G4. While this was all done on Tiger, it will most likely also work on Leopard.</p>
<h3><strong>Preparations</strong></h3>
<p>The installation process follows mostly the unix standard. That means that you will want to have the a /usr/local folder made. If you do not have it yet, type the following in terminal:</p>
<p><code>sudo mkdir /usr/local </code></p>
<p>The advantage of using local is that whenever a system updates itself it leaves local alone. If you install directly into /usr/bin, there is a chance that a system update will overwrite your installed software with its own update. If you lost me by now, you are probably off downloading a MAMP binary now.</p>
<p>The first step is to retrieve the packages we will need to properly install MAMP. To keep it nice and organized make a folder that will contain the source code, if you do not yet have a designated folder.</p>
<p><code>mkdir ~/src</code></p>
<p>We can now start installing MAMP</p>
<h3><strong>Installation</strong></h3>
<h4>MySQL</h4>
<p>The first thing that will be installed is MySQL. You can get the latest dmg <a href="http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg" target="blank">here</a>. After installing MySQL from the dmg, I also recommend installing <a href="http://www.sequelpro.com" target="blank">Sequelpro</a> if you want a GUI interface to the database. For building MySQL yourself from source check <a href="http://hivelogic.com/articles/view/installing-mysql-on-mac-os-x" target="blank">this</a>.</p>
<h4>Apache2</h4>
<p>Apache comes bundled with OS X. Note that the control panel will only affect the default installation. Starting and stopping your own Apache installation will need some command line work, or some scripting. The following installs Apache 2 into  /usr/local/sbin/apache2, if you prefer to install into another folder change the prefix to that folder.<br />
<code><br />
curl -O http://apache.hippo.nl/httpd/httpd-2.2.11.tar.gz<br />
tar xvzf http-2.2.11.tar.gz<br />
cd http-2.2.11/<br />
./configure --prefix=/usr/local/sbin/apache2 --enable-modules=all --enable-mods-shared=all<br />
make<br />
sudo make install<br />
cd ..<br />
</code><br />
Before we continue to build PHP there are some extra libraries that are needed. If you are not interested in building PHP with GD you can probably skip most of them.</p>
<h4>Freetype</h4>
<p>A Free, High-Quality, and Portable Font Engine. You can learn more about it <a href="http://www.freetype.org">here</a>.<br />
<code><br />
curl -O http://mirrors.zerg.biz/nongnu/freetype/freetype-2.3.9.tar.gz<br />
tar xvzf freetype-2.3.9.tar.gz<br />
cd freetype-2.3.9/<br />
./configure<br />
make<br />
sudo make install<br />
cd ..<br />
</code></p>
<h4>JPEG</h4>
<p>Support for jpeg image format<br />
<code><br />
curl -O http://www.ijg.org/files/jpegsrc.v6b.tar.gz<br />
tar xzf jpegsrc.v6b.tar.gz<br />
cd jpeg-6b/<br />
cp /usr/share/libtool/config.sub .<br />
cp /usr/share/libtool/config.guess .<br />
./configure --enable-shared<br />
make<br />
sudo make install<br />
cd ..<br />
</code></p>
<h4>Libpng</h4>
<p>Support for png image format<br />
<code><br />
curl -O ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng-1.2.36.tar.gz<br />
tar xjf libpng-1.2.36.tar.gz<br />
cd libpng-1.2.36/<br />
./configure<br />
make<br />
sudo make install<br />
cd ..<br />
</code></p>
<h4>openSSL</h4>
<p>Install the latest version of openSSL<br />
<code><br />
curl -O http://www.openssl.org/source/openssl-0.9.8k.tar.gz<br />
tar xvzf openssl-0.9.8k.tar.gz<br />
cd openssl-0.9.8k<br />
./config --prefix=/usr/local --openssldir=/usr/local/ssl<br />
make<br />
sudo make install<br />
./config shared --prefix=/usr/local --openssldir=/usr/local/ssl<br />
make clean<br />
make<br />
sudo make install<br />
</code></p>
<h4>PHP</h4>
<p>Now that the extra libraries are available we can continue to build PHP. We choose to install it into <code>/usr/local/php5</code>. As before if you wish to install into a different location, change the prefix.<br />
<code><br />
curl -O http://de3.php.net/distributions/php-5.2.9.tar.bz2<br />
tar xjf php-5.2.9.tar.bz2<br />
cd php-5.2.9/<br />
./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/sbin/apache2/bin/apxs --with-config-file-scan-dir=/usr/local/php5/php.d --with-iconv --with-openssl=/usr/local --with-openssl-dir=/usr/local/ssl --with-zlib=/usr --with-gd --with-zlib-dir=/usr --with-xmlrpc --with-iconv-dir=/usr --enable-exif --enable-sqlite-utf8 --enable-ftp --enable-sockets --enable-dbase --enable-mbstring --with-bz2=/usr --enable-fastcgi --enable-cgi --enable-zip --with-curl --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-libxml-dir=shared,/usr/local/php5 --with-jpeg-dir=/usr/local/php5 --with-png-dir=/usr/local/php5 --with-freetype-dir=/usr/local/php5<br />
make<br />
sudo make install<br />
</code><br />
You should now have a ready development system.</p>
<h3>Finalization</h3>
<p>To make sure that the newly installed software is used instead of the default installed one make sure that <code>/usr/local</code> and the bin and php5 folders within are in the path before <code>/usr/bin</code>.<br />
To start the Apache server use the following command:<br />
<code><br />
sudo /usr/local/sbin/apache2/bin/apachectl start<br />
</code><br />
Use <code>stop</code> and <code>restart</code> to stop or restart the server.</p>
<h4>Credit</h4>
<p>This article is inspired by the following three great guides:<br />
<a href="http://projects.serenity.de/php/">Compiling Apache and PHP (and MySQL) on Mac OS X Leopard</a><br />
<a href="http://www.bioneural.net/2005/04/22/apache-2-php-5-mysql-4-under-mac-os-x-1039/">Apache 2 + PHP 5 + MySQL 4 under OS X 10.3.9</a><br />
<a href="http://www.klauskomenda.com/archives/2008/10/07/installing-apache-mysql-and-php-on-leopard/">Installing Apache, MySQL and PHP on Leopard</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kfirbreger.com/2009/05/04/installing-apache2-php5-and-mysql5-on-os-x-tiger/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

