<?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>wekadesign &#187; php</title>
	<atom:link href="http://www.wekadesign.co.nz/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wekadesign.co.nz</link>
	<description>web apps that solve problems</description>
	<lastBuildDate>Sat, 28 May 2011 08:40:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Debug PHP Function Calls</title>
		<link>http://www.wekadesign.co.nz/2011/02/11/debug-php-function-calls/</link>
		<comments>http://www.wekadesign.co.nz/2011/02/11/debug-php-function-calls/#comments</comments>
		<pubDate>Fri, 11 Feb 2011 07:49:23 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[backtrace]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/?p=298</guid>
		<description><![CDATA[Logging errors can be very helpful as your code base becomes huge. But sometime it&#8217;s still difficult to find out what&#8217;s calling the function that&#8217;s giving the error. Wouldn&#8217;t it [...]]]></description>
			<content:encoded><![CDATA[<p>Logging errors can be very helpful as your code base becomes huge. But sometime it&#8217;s still difficult to find out what&#8217;s calling the function that&#8217;s giving the error. Wouldn&#8217;t it be nice if there was a way to see how you&#8217;d got to that function?</p>
<p>Well of course there&#8217;s a way in <a href="http://nz.php.net/manual/en/function.debug-backtrace.php" target="_blank">PHP</a> &#8211; <strong>debug_backtrace</strong>. Just add something similar in a suitable place in your code and you&#8217;ll be able to find what functions were called.</p>
<pre><code>$trace=debug_backtrace();
$caller = $trace[1]['function'];
// or just dump all the info
var_dump($trace);</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2011/02/11/debug-php-function-calls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LDAP in PHP on IIS6</title>
		<link>http://www.wekadesign.co.nz/2010/05/28/ldap-in-php-on-iis6/</link>
		<comments>http://www.wekadesign.co.nz/2010/05/28/ldap-in-php-on-iis6/#comments</comments>
		<pubDate>Fri, 28 May 2010 06:07:07 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[iis6]]></category>
		<category><![CDATA[ldap]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/?p=188</guid>
		<description><![CDATA[If you&#8217;re struggling to get the LDAP extension to work in PHP and IIS6 then you may want to read on. In my situation both the web server and PHP [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re struggling to get the LDAP extension to work in PHP and IIS6 then you may want to read on. In my situation both the web server and PHP were confirmed to be working fine and reading the correct php.ini. But even with the correct line enabled in the <em>php.ini</em> file, LDAP would refuse to show in <em>phpinfo()</em> output.</p>
<p>After some searching of my own, it turns out that IIS6 on Windows Server 2003 (possibly XP too) will not properly read the PATH variable. So if you add the path to your PHP directory to the end of PATH, the DLLs required are still not found. This looks to affect IIS6 specifically as filesystem calls to the same DLLs did find them.</p>
<p>The solution &#8211; add the path to your PHP install to the start or earlier in the PATH variable and restart IIS. In my experience you will now see the LDAP options appear in your <em>phpinfo()</em> output.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2010/05/28/ldap-in-php-on-iis6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running WordPress &amp; PHP Behind ISA Proxy</title>
		<link>http://www.wekadesign.co.nz/2010/05/14/running-wordpress-php-behind-isa-proxy/</link>
		<comments>http://www.wekadesign.co.nz/2010/05/14/running-wordpress-php-behind-isa-proxy/#comments</comments>
		<pubDate>Fri, 14 May 2010 06:23:45 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[cntlm]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/?p=178</guid>
		<description><![CDATA[Some things work well on their own but when mixed make your life hard. Things like Linux and PHP work very well. Microsoft ISA proxy also does a good job [...]]]></description>
			<content:encoded><![CDATA[<p>Some things work well on their own but when mixed make your life hard. Things like Linux and PHP work very well. Microsoft ISA proxy also does a good job in a corporate MS environment. But making the two work together in a controlled environment can be an exercise in frustration.</p>
<p>In this post I&#8217;ll pass on the methods I found to get PHP and your Linux boxes talking out through a corporate ISA proxy server. You can then bring in RSS feeds, updates and other things in WordPress and use <em>apt-get</em> to update Ubuntu.<span id="more-178"></span></p>
<h3>cntlm</h3>
<p>To start with we need to install <a href="http://cntlm.sourceforge.net/" target="_blank"><em>cntlm</em></a> on a Linux box (I&#8217;ll mention Ubuntu here but any flavour should work with a couple of tweaks). <em>cntlm</em> is &#8220;<em>an NTLM / NTLM Session Response / NTLMv2 authenticating HTTP proxy</em>&#8220;. Basically your non-Windows machines and apps can now talk to <em>cntlm</em> which will then talk to the ISA proxy in your organisation. So you stay within your corporate infrastructure and keep the security guys happy.</p>
<p>Download the deb installation package to your Ubuntu machine and install it with,</p>
<pre>sudo dpkg -i cntlm_0.35.1-1_i386.deb</pre>
<p>Open the config file for <em>cntlm</em> and edit it to add in your ISA proxy information and a valid user, domain and password that has web access with download rights. Further down the settings make sure gateway is enabled and you set suitable restrictions on the IP ranges that can use <em>cntlm</em>.</p>
<pre>sudo nano /etc/cntlm.conf</pre>
<p>Restart <em>cntlm</em> to make sure it gets the new settings,</p>
<pre>sudo /etc/init.d/cntlm restart</pre>
<p>Test your <em>cntlm</em> configuration by attempting to get to an external website,</p>
<pre>sudo cntlm -M <a href="http://www.google.com/" target="_blank">http://www.google.com</a> -u your_user@your_domain -p your_password your_isa_proxy:port</pre>
<h3>apt-get</h3>
<p>Configure <em>apt-get</em> to use the new proxy by editing the <em>apt-get</em> config,</p>
<pre>sudo nano /etc/apt/apt.conf.d/70debconf</pre>
<p>and add this line pointing to your <em>cntlm</em> proxy gateway. Change the IP and port if you&#8217;ve installed <em>cntlm</em> on another machine or different port.</p>
<pre>Acquire::http::proxy "http://127.0.0.1:3128";</pre>
<h3>WordPress</h3>
<p>Add these extra lines to the wp-config.php file in your WordPress directory. This works from version 2.8 onward and means you can keep your install and plugins up to date and secure. Again, make sure you change the IP and port to that of your <em>cntlm</em> proxy gateway. You may be able to comment out the username and password if things don&#8217;t work as expected. It&#8217;ll depend on your <em>cntlm</em> configuration.</p>
<pre>define('WP_PROXY_HOST', '127.0.0.1');
define('WP_PROXY_PORT', '3128');
define('WP_PROXY_USERNAME', 'my_user_name');
define('WP_PROXY_PASSWORD', 'my_password');
define('WP_PROXY_BYPASS_HOSTS', 'localhost, www.example.com');</pre>
<p>With any luck you now have a Linux machine and WordPress install that can easily be kept up to date inside your corporate environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2010/05/14/running-wordpress-php-behind-isa-proxy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Outlook Hates Line Breaks</title>
		<link>http://www.wekadesign.co.nz/2010/01/22/outlook-hates-line-breaks/</link>
		<comments>http://www.wekadesign.co.nz/2010/01/22/outlook-hates-line-breaks/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 18:56:11 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[line breaks]]></category>
		<category><![CDATA[outlook]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpmailer]]></category>

		<guid isPermaLink="false">http://www.wekadesign.co.nz/?p=170</guid>
		<description><![CDATA[If you&#8217;ve ever wondered why your plain text email message is randomly ignoring line breaks like \n or \r\n then you&#8217;re not alone. I regularly use PHPMailer to send off [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve ever wondered why your plain text email message is randomly ignoring line breaks like \n or \r\n then you&#8217;re not alone. I regularly use PHPMailer to send off automated emails and usually in plain text to keep it simple.</p>
<p>What Outlook 2003 (and 2002 and 2007 versions apparently) likes to do is be super helpful and remove what it regards as extra line breaks. It won&#8217;t be consistent either within a single mail or across many but it will make the content difficult to read. What you thought would be new lines will now be joined up in places and it seems to happen more often the further through the content you go.</p>
<p>There don&#8217;t seem to be many fixes for this issue but there are a few work arounds to help out.</p>
<ol>
<li>Turn off this &#8220;feature&#8221; in Outlook in the Tools»Options menu. Honestly I&#8217;m not sure what use it is anyway. Unfortunately you&#8217;d have to do this on all the recipient&#8217;s computers.</li>
<li>Use HTML in your email rather than plain text. Depending on your content and need for complete accuracy, perhaps more time than it&#8217;s worth.</li>
<li>Add twice the number of line breaks where you currently have them. This seems to help but now your email is rather full of white space and may be more difficult to read.</li>
</ol>
<p>Other than changing email clients, which is pretty unlikely, that&#8217;s about it. If you know of other options to try and get Outlook to not remove line breaks, please leave a comment below. This Microsoft KB article explains which versions of Outlook are affected <a href="http://support.microsoft.com/kb/287816" target="_blank">http://support.microsoft.com/kb/287816</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2010/01/22/outlook-hates-line-breaks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing a Windows Dev Box</title>
		<link>http://www.wekadesign.co.nz/2006/05/14/installing-a-windows-dev-box/</link>
		<comments>http://www.wekadesign.co.nz/2006/05/14/installing-a-windows-dev-box/#comments</comments>
		<pubDate>Sun, 14 May 2006 05:46:24 +0000</pubDate>
		<dc:creator>Mike McMurray</dc:creator>
				<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[subversion]]></category>

		<guid isPermaLink="false">http://wekadesign.co.nz/blog/?p=17</guid>
		<description><![CDATA[In the interest of saving this for future reference, here&#8217;s is a general how-to for installing a Windows based Web development server. The reason for running up a Windows server [...]]]></description>
			<content:encoded><![CDATA[<p>In the interest of saving this for future reference, here&#8217;s is a general how-to for installing a Windows based Web development server.</p>
<p>The reason for running up a Windows server as opposed to the typical LAMP alternative on Windows was due to frustration. The older Ubuntu server I had just made it very difficult to install the versions of PHP and MySQL that I wanted.</p>
<p>Applications I used were:<br />
Apache 2.0.55<br />
PHP 4.4.2<br />
MySQL 4.1.18<br />
Subverison 1.3<br />
<span id="more-17"></span></p>
<p><strong>Download</strong><br />
The application packages you need to download are:<br />
<a href="http://www.apache.org">apache</a>_2.0.55-win32-x86-no_ssl.msi<br />
<a href="http://www.mysql.com">mysql</a>-essential-4.1.18-win32.msi<br />
<a href="http://www.php.net">php</a>-4.4.2-Win32.zip<br />
<a href="http://subversion.tigris.org">svn</a>-1.3.0-setup.exe<br />
<a href="http://dark.clansoft.dk/~mbn/svnservice/">svnservice </a>(to run Subversion as a Windows service/daemon)</p>
<p><strong>Installation</strong><br />
Now we&#8217;ve downloaded the right files we need to install them. for the most part this involves double-clicking the installer package and clicking Next a few times.</p>
<p>Install MySQL and use the Server Config tool to set options including Network Access.<br />
Install Apache to the default location.<br />
Unzip the PHP files to c:\php folder.<br />
Install Subversion using the package defaults.<br />
Unzip the SVNService tool to the Subversion folder and copy the <code>SVNService.exe</code> file to the <code>bin</code> directory.</p>
<p><strong>Configuration</strong></p>
<p><strong>PHP</strong><br />
In the <code>c:\php</code> folder, copy the file <code>php.ini-recommended</code> to <code>php.ini</code>. Change the line that says,<br />
<code>doc_root = </code><br />
to read<br />
<code>doc_root = c:\progra~1\apache~1\apache\htdocs</code></p>
<p>Set the error reporting to a more appropriate level by changing the line that reads,<br />
<code>error_reporting  =  E_ALL</code><br />
to<br />
<code>error_reporting  =  E_ERROR|E_PARSE</code></p>
<p>Copy <code>php.ini</code> to your Windows folder eg. <code>c:\windows\</code></p>
<p>Add the directory path <code>c:\php</code> to your system PATH variable, through My Computerâ†’Propertiesâ†’Advanced<br />
Apache</p>
<p>Open the file c:\progra~1\apache~1\apache\conf\httpd.conf and add the following lines,<br />
<code>LoadModule php4_module "c:/php/php4apache2.dll"</code><br />
and further down,<br />
<code>AddType application/x-httpd-php .php</code></p>
<p><strong>Edit:</strong> I neglected to add in some other lines when writing this. In the Apache conf file&#8217;s Module section add,<br />
<code>LoadModule dav_svn_module "C:/Program Files/Subversion/bin/mod_dav_svn.so"</code><br />
<code>LoadModule authz_svn_module "C:/Program Files/Subversion/bin/mod_authz_svn.so"</code><br />
Of course you should change the path to match that of the library files in your Subversion install folder.</p>
<p>Create a file in <code>c:\progra~1\apache~1\apache\htdocs</code> called <code>test.php</code>. In that file place this text,</p>
<p><code>&lt;?php</code><br />
<code>phpinfo();</code><br />
<code>?&gt;</code></p>
<p>Restart the server</p>
<p>Open your browser and go the URL <em>http://your_server/test.php</em>.</p>
<p>You should see a page listing the current PHP settings. If not, check that the Apache service is running and that you can browse to http://. If that works then check the PHP configuration.</p>
<p><strong>Subversion</strong><br />
Create a folder to hold your Subversion repository eg. <code>c:\svn</code>. In that folder create your folder structure for your code. Check the Subversion docs for the guidelines on how to do this the best way. To simply create a new repository called &#8216;project&#8217; type the following line at a command prompt.<br />
<code>svnadmin create c:\svn\project</code></p>
<p>At a command prompt type,<br />
<code>svnservice -install -d -r c:\svn\project</code><br />
which installs and starts the SVN service and tells it to run as a daemon (-d) and point to your code repository (-r xxxxx).</p>
<p>Open up Apache&#8217;s config file again (httpd.conf) and add the following code at the bottom of the file,<br />
<code>&lt;Location /subversion&gt;<br />
DAV svn<br />
SVNPath c:/svn/project<br />
AuthType Basic<br />
AuthName "Subversion Repository"<br />
AuthUserFile conf/svnusers.conf<br />
Require valid-user<br />
&lt;/Location&gt;</code><br />
This tells Apache that any requests for http://your_server/subversion, will use web_dav to look at your code repository at <code>c:\svn\project</code> and only let authorized users see it.</p>
<p>Now we still need to tell Apache who is allowed to view our Subversion repository and who can read and write to our repo(sitory) too. At the cmd prompt again change directory to your Apache conf folder and type,<br />
<code>htpasswd -c svnusers.conf username</code><br />
making sure you replace the &#8216;username&#8217; with your real username. You&#8217;ll be asked to provide a password for that user which Apache will use.</p>
<p>And in the &#8216;project&#8217; repo at <code>c:\svn\project</code> open the <code>conf</code> folder and edit the svnserve.conf file with a text editor. Uncomment a few lines until you have at least,<br />
<code>[general]<br />
anon-access = read  ## Can be none, read, write<br />
auth-access = write   ## Can be none, read, write<br />
password-db = passwd  ## Filename of users store<br />
realm = My Project</code></p>
<p>Now we need to create a <code>passwd </code>file to store the usernames and password used to control access to the repository. It&#8217;s a s imple as a text file with the lines below in it. Add extra users on new line but watch that both username and password are case sensitive.<br />
<code>[users]<br />
myuser= mypassword</code></p>
<p><strong>Extras</strong><br />
If you are unable to connect to the MySQL server using PHPMyAdmin or similar and receive a message like,<br />
<em>Error 1251: &#8220;Client does not support authentication protocol requested by server; consider upgrading MySQL client&#8221;</em>, do not despair.</p>
<p>From a MySQL prompt on your server run the command below for each affected user@machine combination.</p>
<p><code>SET PASSWORD FOR user@localhost = OLD_PASSWORD('password');</code></p>
<p>Making sure you replace the &#8216;user&#8217; and &#8216;password&#8217; with your own details.</p>
<p><strong>Conclusion</strong><br />
Hope that all made sense, if not just leave a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.wekadesign.co.nz/2006/05/14/installing-a-windows-dev-box/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: basic
Database Caching 12/19 queries in 0.012 seconds using disk: basic

Served from: www.wekadesign.co.nz @ 2012-02-06 19:55:05 -->
