<?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>www.pokeroconnor.com &#187; php</title>
	<atom:link href="http://www.pokeroconnor.com/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pokeroconnor.com</link>
	<description></description>
	<lastBuildDate>Fri, 19 Aug 2011 18:59:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>SPL CSV File Iterator</title>
		<link>http://www.pokeroconnor.com/spl-csv-files/</link>
		<comments>http://www.pokeroconnor.com/spl-csv-files/#comments</comments>
		<pubDate>Mon, 01 Aug 2011 18:48:58 +0000</pubDate>
		<dc:creator>PokerOConnor</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.pokeroconnor.com/?p=428</guid>
		<description><![CDATA[When using PHP&#8217;s SplFileObject for CSV file manipulation, as you will likely discover fgetcsv() also includes empty lines in the returned array. The suggestion is to use SplFileObject::DROP_NEW_LINE or SplFileObject::SKIP_EMPTY to handle this. However, I find I often need to use both to achieve the desired result of ignoring blank or empty lines. To achieve [...]]]></description>
			<content:encoded><![CDATA[<p>When using PHP&#8217;s SplFileObject for <a href="http://ie.php.net/manual/en/splfileobject.fgetcsv.php">CSV file manipulation</a>, as you will likely discover <em>fgetcsv</em>() also includes empty lines in the returned array.</p>
<p>The suggestion is to use <em>SplFileObject::DROP_NEW_LINE</em> or <em>SplFileObject::SKIP_EMPTY</em> to handle this.</p>
<p>However, I find I often need to use <strong>both</strong> to achieve the desired result of ignoring blank or empty lines. To achieve this, you need to use a bitmask in your <em>setflags</em> argument.</p>
<p>A value of &#8217;7&#8242; corresponds to both <em>SplFileObject::DROP_NEW_LINE</em> AND <em>SplFileObject::SKIP_EMPTY, e.g.<br />
</em></p>
<p><em><strong>$file = new SplFileObject($path); </strong></em><br />
<em><strong>$file-&gt;setFlags(7);</strong></em></p>
<p><em>setFlags(15) </em>would correspond to a <a href="http://www.daniweb.com/web-development/php/threads/331879">bitmask for DROP_NEWLINE, SKIP_EMPTY, READ_CSV</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pokeroconnor.com/spl-csv-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>phpmyadmin debian password protect</title>
		<link>http://www.pokeroconnor.com/phpmyadmin-debian-password-protect/</link>
		<comments>http://www.pokeroconnor.com/phpmyadmin-debian-password-protect/#comments</comments>
		<pubDate>Mon, 01 Nov 2010 23:22:31 +0000</pubDate>
		<dc:creator>PokerOConnor</dc:creator>
				<category><![CDATA[Linux/Unix/OSX/Apache]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.pokeroconnor.com/?p=321</guid>
		<description><![CDATA[Quick one &#8211; steps to password protect your phpmyadmin on Debian. Good idea also to use a symlink to obfuscate the &#8216;phpmyadmin&#8217; url too. Eg. within the docroot of a site I wish to install phpmyadmin on, I would do: cd /var/www/site ln -s SECRET_PATH_TO_DB /usr/share/phpmyadmin/ Your phpmyadmin install is then available on site.com/SECRET_PATH_TO_DB For [...]]]></description>
			<content:encoded><![CDATA[<p>Quick one &#8211; steps to<a href="http://www.halecomm.net/blog/2010/03/htpasswd-protecting-your-phpmyadmin-installation-debian/"> password protect your phpmyadmin on Debian</a>.</p>
<p>Good idea also to use a symlink to obfuscate the &#8216;phpmyadmin&#8217; url too.</p>
<p>Eg. within the docroot of a site I wish to install phpmyadmin on, I would do:</p>
<p>cd /var/www/site</p>
<p>ln -s SECRET_PATH_TO_DB /usr/share/phpmyadmin/</p>
<p>Your phpmyadmin install is then available on site.com/SECRET_PATH_TO_DB</p>
<p>For the htaccess password protection, this is a<a href="http://www.htaccesstools.com/htpasswd-generator/"> very handy generator tool.</a> The username and password you choose for the .htpasswd protection should be saved to <strong>/usr/share/phpmyadmin/.htpasswd</strong> (swap /usr/share for whatever install path you have).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pokeroconnor.com/phpmyadmin-debian-password-protect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xampp setup for mac</title>
		<link>http://www.pokeroconnor.com/xampp-setup-for-mac/</link>
		<comments>http://www.pokeroconnor.com/xampp-setup-for-mac/#comments</comments>
		<pubDate>Wed, 15 Sep 2010 22:06:33 +0000</pubDate>
		<dc:creator>PokerOConnor</dc:creator>
				<category><![CDATA[Linux/Unix/OSX/Apache]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.pokeroconnor.com/?p=312</guid>
		<description><![CDATA[For local development I use Xampp, which I find to be very handy. It&#8217;s really simple to and quick to setup, but there were just 2 gripes I had when setting it up that took an hour or so to fix &#8211; very annoying, so just recording them here for reference. Firstly, the install is [...]]]></description>
			<content:encoded><![CDATA[<p>For local development I use <a href="http://www.apachefriends.org/en/xampp-macosx.html">Xampp</a>, which I find to be very handy. It&#8217;s really simple to and quick to setup, but there were just 2 gripes I had when setting it up that took an hour or so to fix &#8211; very annoying, so just recording them here for reference.</p>
<p>Firstly, the install is as easy as detailed on the <a href="http://www.apachefriends.org/en/xampp-macosx.html">official page</a>, and the best guide I found was <a href="http://www.acwolf.com/2009/02/24/xampp-virtual-hosts-on-a-mac/">this excellent one</a>.</p>
<p>There are a tonne of files in your /Applications/XAMPP folder, but the most usual thing is to setup a Vhost. Edit the /Applications/XAMPP/etc/extra/httpd-vhosts.conf file for that.</p>
<p><strong>BUT</strong>, the first catch is you need to ensure that the following line is <strong>uncommented</strong> in the /Applications/XAMPP/etc/httpd.conf file:</p>
<p><em> Include etc/extra/httpd-xampp.conf</em></p>
<p>Gaaahhh!!!</p>
<p>Second gripe, your htaccess or <a href="http://www.talkphp.com/general/4774-mod_rewrite-not-working.html">mod_rewrite won&#8217;t work probably</a>, so you need to make sure that<em><strong> AllowOverride None </strong></em>is changed to <em><strong>AllowOverride All </strong></em>in /Applications/XAMPP/etc/httpd.conf, e.g.</p>
<p><em>&lt;Directory /&gt;<br />
Options FollowSymLinks<br />
AllowOverride All</em></p>
<p>Apart from those two minor annoyances, it was plain sailing!</p>
<p><em><br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pokeroconnor.com/xampp-setup-for-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress site redirect</title>
		<link>http://www.pokeroconnor.com/wordpress-site-redirect/</link>
		<comments>http://www.pokeroconnor.com/wordpress-site-redirect/#comments</comments>
		<pubDate>Sat, 13 Feb 2010 18:01:51 +0000</pubDate>
		<dc:creator>PokerOConnor</dc:creator>
				<category><![CDATA[hosting]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.pokeroconnor.com/?p=297</guid>
		<description><![CDATA[I had the following problem lately: I added the typical rules to htaccess to redirect example.com/anything to www.example.com/anything, e.g. RewriteEngine On RewriteCond %{HTTP_HOST} ^example.com [NC] RewriteRule (.*)$ http://www.example.com/$1 [L,NC,R=301] RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] But when I went to example.com I got infinite redirects&#8230;reason being I had the [...]]]></description>
			<content:encoded><![CDATA[<p>I had the following problem lately: I added the typical rules to htaccess to redirect example.com/anything to www.example.com/anything, e.g.</p>
<p><code> </code></p>
<p><code>RewriteEngine On</code></p>
<p><code>RewriteCond %{HTTP_HOST} ^example.com [NC]<br />
RewriteRule (.*)$ http://www.example.com/$1 [L,NC,R=301]</code></p>
<p><code> </code></p>
<p><code>RewriteBase /<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteRule . /index.php [L]</p>
<p></code></p>
<p>But when I went to example.com I got infinite redirects&#8230;reason being I had the siteurl field in the wp_options table of the database set to http://example.com.</p>
<p>So, you need to change that to http://<strong>www</strong>.example.com, and <strong>also edit wp-config.php</strong> as follows:<br />
<code><br />
define('WP_HOME','http://www.example.com');<br />
define('WP_SITEURL','http://www.example.com');</code></p>
<p>That should be it -<a href="http://codex.wordpress.org/Changing_The_Site_URL"> see here if not</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pokeroconnor.com/wordpress-site-redirect/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using CURL to access certain IP of a Domain</title>
		<link>http://www.pokeroconnor.com/curl-access-ip-of-domain/</link>
		<comments>http://www.pokeroconnor.com/curl-access-ip-of-domain/#comments</comments>
		<pubDate>Thu, 23 Jul 2009 21:56:36 +0000</pubDate>
		<dc:creator>PokerOConnor</dc:creator>
				<category><![CDATA[Linux/Unix/OSX/Apache]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.pokeroconnor.com/?p=260</guid>
		<description><![CDATA[Something I needed to do recently was get the contents of a certain url of a certain domain name, for each of the IP addresses associated with that domain name. In other words, there was a domain we shall call www.test-domain.com, which was hosted on 5 different servers, with IPs 1.2.3.100 through 1.2.3.104. I wanted [...]]]></description>
			<content:encoded><![CDATA[<p>Something I needed to do recently was get the contents of a certain url of a certain domain name, for each of the IP addresses associated with that domain name. In other words, there was a domain we shall call www.test-domain.com, which was hosted on 5 different servers, with IPs 1.2.3.100 through 1.2.3.104. I wanted to automate the getting of the contents of www.test-domain.com/file-name.php on each of these servers. I could set my hosts file of course, and point at each server, blah blah blah, but this had to be automated, for sanity.</p>
<p>The <a href="http://ie2.php.net/curl">php curl library</a> is fully awesome, but personally I find this page to be the <a href="http://ie2.php.net/manual/en/function.curl-setopt.php">most useful</a>. There are surprisingly few examples of this anywhere on the web&#8230;just try googling this topic and you get nothing at all relevant!</p>
<p>The solution is simple enough, but believe me it won&#8217;t be easy to find on the web &#8211; thanks to a certain work colleague for the expert advice on this! Basically you need to inject a header using CURLOPT_HTTPHEADER, and then use CURLOPT_URL with the actual IP address.</p>
<p>For example:<br />
<code><br />
$ch = curl_init();<br />
$headers = array("Host: www.test-domain.com");</code></p>
<p><code>curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);<br />
curl_setopt($ch, CURLOPT_URL, "http://1.2.3.100/file-name.php");</code></p>
<p><code> </code></p>
<p><code>curl_exec($ch);<br />
</code></p>
<p>That&#8217;s the engine of it, a very neat little solution!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pokeroconnor.com/curl-access-ip-of-domain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zend Form Password</title>
		<link>http://www.pokeroconnor.com/zend-form-password/</link>
		<comments>http://www.pokeroconnor.com/zend-form-password/#comments</comments>
		<pubDate>Sat, 16 May 2009 23:17:09 +0000</pubDate>
		<dc:creator>PokerOConnor</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.pokeroconnor.com/?p=248</guid>
		<description><![CDATA[When using Zend Form, and you have a password field and confirm password field, it is very handy to use Validation Context. It is described in the Zend documentation, just search for &#8220;My_Validate_PasswordConfirmation&#8221;. As is typical in Zend docs, the example is shit, they just give a class definition. So, here&#8217;s a brief example of I [...]]]></description>
			<content:encoded><![CDATA[<p>When using Zend Form, and you have a password field and confirm password field, it is very handy to use <em>Validation Context</em>. It is described in the <a href="http://framework.zend.com/manual/en/zend.form.elements.html">Zend documentation</a>, just search for &#8220;My_Validate_PasswordConfirmation&#8221;. As is typical in Zend docs, the example is shit, they just give a class definition. So, here&#8217;s a brief example of I used it.</p>
<p>Basically what you need to do is attach the validator to both the password <em><strong>and</strong></em> the confirm password field. </p>
<p>So firstly, add the class:<br />
<code><br />
class My_Validate_PasswordConfirmation extends Zend_Validate_Abstract<br />
{<br />
const NOT_MATCH = 'notMatch';</code></p>
<p><code>protected $_messageTemplates = array(<br />
self::NOT_MATCH =&gt; 'Password confirmation does not match'<br />
);</code></p>
<p><code>public function isValid($value, $context = null)<br />
{<br />
$value = (string) $value;<br />
$this-&gt;_setValue($value);</code></p>
<p><code>if (is_array($context)) {<br />
if (isset($context['password_confirm'])<br />
&amp;&amp; ($value == $context['password_confirm']))<br />
{<br />
return true;<br />
}<br />
} elseif (is_string($context) &amp;&amp; ($value == $context)) {<br />
return true;<br />
}</p>
<p></code></p>
<p> </p>
<p> </p>
<p><code> $this-&gt;_error(self::NOT_MATCH);<br />
return false;<br />
}<br />
}</code></p>
<p>Then, in your form file, use it something like follows:<br />
<code><br />
class RegisterForm extends Zend_Dojo_Form</code></p>
<p><code>{</code></p>
<p><code>public function init()</code></p>
<p><code>{<br />
$form = new Zend_Form();<br />
....<br />
....<br />
....<br />
$custom_pass = new MyValidatePasswordConfirmation();</p>
<p>...<br />
...<br />
$password = $form-&gt;createElement('password', 'password')<br />
-&gt;addValidator('StringLength', false, array(1,24))<br />
-&gt;setLabel('Choose your password:')<br />
-&gt;addValidator('Alnum')<br />
-&gt;addValidator($custom_pass)<br />
-&gt;setRequired(true);</p>
<p></code></p>
<p> </p>
<p> </p>
<p><code> $password_confirm = $form-&gt;createElement('password', 'password_confirm')<br />
-&gt;addValidator('StringLength', false, array(1,24))<br />
-&gt;setLabel('Confirm your password:')<br />
-&gt;addValidator('Alnum')<br />
-&gt;addValidator($custom_pass)<br />
-&gt;setRequired(true);<br />
</code></p>
<p>It&#8217;s fairly straightforward, but of course there&#8217;s very few examples I could find, this is <a href="http://www.zfforums.com/zend-framework-general-discussions-1/general-q-zend-framework-2/need-help-zend_form-723.html">probably the best</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pokeroconnor.com/zend-form-password/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Zend Form Validators</title>
		<link>http://www.pokeroconnor.com/zend-form-validators/</link>
		<comments>http://www.pokeroconnor.com/zend-form-validators/#comments</comments>
		<pubDate>Fri, 01 May 2009 21:01:42 +0000</pubDate>
		<dc:creator>PokerOConnor</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.pokeroconnor.com/?p=240</guid>
		<description><![CDATA[I have another post with info on Zend validators, but here&#8217;s a very handy class to specify a maximum and minimum value to validate against. E.g. you have a form value that must be between 1 and 10 &#8211; Zend Validate doesn&#8217;t have a validator for that, but this class will allow you to. Just [...]]]></description>
			<content:encoded><![CDATA[<p>I have <a href="http://www.pokeroconnor.com/zend-framework-starters/">another post</a> with info on Zend validators, but here&#8217;s a <a href="http://framework.zend.com/manual/en/zend.validate.writing_validators.html">very handy class</a> to specify a maximum and minimum value to validate against. E.g. you have a form value that must be between 1 and 10 &#8211; Zend Validate doesn&#8217;t have a validator for that, but this class will allow you to. Just set $minimum and $maximum to your limits.</p>
<p><code><br />
class MyValidNumericBetween extends Zend_Validate_Abstract<br />
{<br />
const MSG_NUMERIC = 'msgNumeric';<br />
const MSG_MINIMUM = 'msgMinimum';<br />
const MSG_MAXIMUM = 'msgMaximum';</code></p>
<p><code>public $minimum = 1;<br />
public $maximum = 45;</code></p>
<p><code> </code></p>
<p><code>protected $_messageVariables = array(<br />
'min' =&gt; 'minimum',<br />
'max' =&gt; 'maximum'<br />
);</code></p>
<p><code>protected $_messageTemplates = array(<br />
self::MSG_NUMERIC =&gt; "'%value%' is not numeric",<br />
self::MSG_MINIMUM =&gt; "'%value%' must be at least '%min%'",<br />
self::MSG_MAXIMUM =&gt; "'%value%' must be no more than '%max%'"<br />
);</code></p>
<p><code>public function isValid($value)<br />
{<br />
$this-&gt;_setValue($value);</code></p>
<p><code>if (!is_numeric($value)) {<br />
$this-&gt;_error(self::MSG_NUMERIC);<br />
return false;<br />
}</code></p>
<p><code>if ($value &lt; $this-&gt;minimum) {<br />
$this-&gt;_error(self::MSG_MINIMUM);<br />
return false;<br />
}</code></p>
<p><code>if ($value &gt; $this-&gt;maximum) {<br />
$this-&gt;_error(self::MSG_MAXIMUM);<br />
return false;<br />
}</p>
<p></code></p>
<p> </p>
<p> </p>
<p> </p>
<p><code> return true;<br />
}<br />
}<br />
</code></p>
<p>And to use this class, assuming you have a normal form instantiated with $form = new Zend_Form(),  just do:</p>
<p><code><br />
$custom_valid8r = new MyValidNumericBetween();</code></p>
<p><code> </code></p>
<p><code>$ball1 = $form-&gt;createElement('text', 'ball1')<br />
-&gt;addValidator($custom_valid8r)<br />
-&gt;setRequired(true);<br />
</code></p>
<p>And to set a custom message here are 2 links with good examples, some of them re-printed below.<br />
<a href="http://framework.zend.com/manual/en/zend.validate.html#zend.validate.introduction.definition"> Firstly</a>:<br />
<code><br />
$validator = new Zend_Validate_StringLength(8);</code></p>
<p><code>$validator-&gt;setMessage(<br />
'The string \'%value%\' is too short; it must be at least %min% ' .<br />
'characters',<br />
Zend_Validate_StringLength::TOO_SHORT);</code></p>
<p><code>if (!$validator-&gt;isValid('word')) {<br />
$messages = $validator-&gt;getMessages();<br />
echo current($messages);</code></p>
<p><code>// "The string 'word' is too short; it must be at least 8 characters"<br />
}</p>
<p></code><br />
<a href="http://framework.zend.com/manual/en/zend.validate.set.html"> Secondly</a>:<br />
<code><br />
$validator = new Zend_Validate_StringLength(8, 12);</code></p>
<p><code>$validator-&gt;setMessages( array(<br />
Zend_Validate_StringLength::TOO_SHORT =&gt;<br />
'The string \'%value%\' is too short',<br />
Zend_Validate_StringLength::TOO_LONG  =&gt;<br />
'The string \'%value%\' is too long'<br />
));</code></p>
<p><code>$validator = new Zend_Validate_StringLength(8, 12);</code></p>
<p><code> </code></p>
<p> </p>
<p> </p>
<p><code>if (!validator-&gt;isValid('word')) {<br />
echo 'Word failed: '<br />
. $validator-&gt;value<br />
. '; its length is not between '<br />
. $validator-&gt;min<br />
. ' and '<br />
. $validator-&gt;max<br />
. "\n";<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pokeroconnor.com/zend-form-validators/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Free SMS Gateways</title>
		<link>http://www.pokeroconnor.com/free-sms-gateways/</link>
		<comments>http://www.pokeroconnor.com/free-sms-gateways/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 21:54:57 +0000</pubDate>
		<dc:creator>PokerOConnor</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.pokeroconnor.com/?p=212</guid>
		<description><![CDATA[Will fill in more info later, but here&#8217;s the basics so far: got this amazing free sms Gateway, playSMS. Great install instructions, such as: playSMS Web Interface: 1.  It is important to meet all minimum requiments above 2.  Setup a system user named &#8216;playsms&#8217; to manage playSMS     # adduser playsms     # passwd playsms [...]]]></description>
			<content:encoded><![CDATA[<p>Will fill in more info later, but here&#8217;s the basics so far: got this amazing free sms Gateway, <a href="http://playsms.sourceforge.net/">playSMS</a>. Great install instructions, such as:</p>
<p>playSMS Web Interface:</p>
<p>1.  It is important to meet all minimum requiments above</p>
<p>2.  Setup a system user named &#8216;playsms&#8217; to manage playSMS</p>
<p>    # adduser playsms</p>
<p>    # passwd playsms</p>
<p>    Note: on some Linux distributions adduser and passwd combined (Debian, Ubuntu and maybe others)</p>
<p>3.  On most Linux distributions actions (2) will create system user and group named &#8216;playsms&#8217;</p>
<p>    with home directory /home/playsms, but you will install playSMS in different directory</p>
<p>4.  Create playSMS web root, spool and log and set ownership to user www-data or web server user</p>
<p>    # mkdir -p /var/www/playsms</p>
<p>    # mkdir -p /var/spool/playsms</p>
<p>    # mkdir -p /var/log/playsms</p>
<p>    # chown -R www-data /var/www/playsms</p>
<p>    # chown -R www-data /var/spool/playsms</p>
<p>    # chown -R www-data /var/log/playsms</p>
<p>5.  Extract playSMS package somewhere (Usually in /usr/local/src)</p>
<p>    # tar -zxvf playsms-x.x.x.tar.gz -C /usr/local/src</p>
<p>    Note: x.x.x may vary according to the package name you&#8217;ve download</p>
<p>6.  Copy files and directories inside &#8216;web&#8217; directory to playSMS web root and set ownership again to </p>
<p>    user www-data or apache web server user</p>
<p>    # cd /usr/local/src/playsms-x.x.x/web</p>
<p>    # cp -rR * /var/www/playsms</p>
<p>    # chown -R www-data /var/www/playsms</p>
<p>    Note: assumed your web server user is www-data</p>
<p>7.  Setup database (import database)</p>
<p>    # mysqladmin -u root -p create playsms</p>
<p>    # mysql -u root -p playsms &lt; /usr/local/src/playsms-x.x.x/db/playsms.sql</p>
<p>    Note: you dont need to use MySQL root access nor this method to setup playSMS</p>
<p>    database, but this is beyond our scope, you should read MySQL manual&#8217;s for custom</p>
<p>    installation method or howto insert SQL statements into existing database</p>
<p>8.  Copy config-dist.php to config.php and edit config.php</p>
<p>    # cd /var/www/playsms</p>
<p>    # cp config-dist.php config.php</p>
<p>    # mcedit config.php</p>
<p>    or </p>
<p>    # vi config.php</p>
<p>    Note: please read and fill all required fields with coutious</p>
<p>9.  Enter bin directory, copy playsms, playsmsd, playsmsd.php, playsmsd_start to directory default</p>
<p>    # cd /usr/local/src/playsms-x.x.x/bin</p>
<p>    # cp playsmsd playsmsd.php playsmsd_start /usr/local/bin/</p>
<p>    # cp playsms /etc/default/</p>
<p>    Note: please note the different between playsms and playsmsd</p>
<p>10. Look for rc.local on /etc and its subdirectories (usualy /etc, /etc/init.d or /etc/rc.d/init.d)</p>
<p>    Edit rc.local and put: </p>
<p>    &#8221;/usr/local/bin/playsmsd_start&#8221; (without quotes)</p>
<p>    on the bottom of the file (before exit if theres exit command). This way playsmsd_start </p>
<p>    will start automatically on boot. </p>
<p>    Note: you need &#8216;root&#8217; access to do this</p>
<p>11  Browse http://localhost/playsms/ and login using default administrator user</p>
<p>    username: admin</p>
<p>    password: admin</p>
<p>12. At this point you should be able to login to playSMS web interface and manage playSMS</p>
<div>There are quite a few requirements though, notably you must have <a href="http://www.easysoft.com/developer/languages/php/pear-db-odbc.html">PEAR DB installed</a>, and also <a href="http://meiert.com/en/blog/20071029/java-and-lynx-for-mac/">Lynx</a> browser. More to follow&#8230;</div>
<div>To install wget, <a href="http://ftp.gnu.org/gnu/wget/">get it here</a>, <a href="http://wget.addictivecode.org/FrequentlyAskedQuestions?action=show&amp;redirect=Faq#head-7c2b3e518b3e1dc0444f7d19a7fdea3326c0dffa">read this</a>. For the <a href="http://www.macosxhints.com/article.php?story=20001105230841401">lynx install</a>, I used /usr/share/libtool/config.guess instead of /usr/libexec/config.guess. </div>
]]></content:encoded>
			<wfw:commentRss>http://www.pokeroconnor.com/free-sms-gateways/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Server Timezones</title>
		<link>http://www.pokeroconnor.com/server-timezones/</link>
		<comments>http://www.pokeroconnor.com/server-timezones/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 21:47:38 +0000</pubDate>
		<dc:creator>PokerOConnor</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.pokeroconnor.com/?p=208</guid>
		<description><![CDATA[You can override your server’s timezone setting using php&#8217;s date_default_timezone_set. It is a really good idea, in my opinion, to use this at the start of your scripts that work with timestamps. Reason being, you can transfer scripts between servers and they will always work, which wouldn&#8217;t necessarily be the case if they depend on a servers timezone [...]]]></description>
			<content:encoded><![CDATA[<p>You can override your server’s timezone setting using php&#8217;s <a href="http://ie2.php.net/manual/en/function.date-default-timezone-set.php">date_default_timezone_set</a>. It is a really good idea, in my opinion, to use this at the start of your scripts that work with timestamps. Reason being, you can transfer scripts between servers and they will always work, which wouldn&#8217;t necessarily be the case if they depend on a servers timezone e.g if you are calculating a unixtime value in your script.</p>
<p>For example, I had an Ajax Calendar app that used Unixtime values to calculate which data to retrieve from a MySQL db. This worked fine on my dev server, whose server timezone was GMT, but when I transferred the code to my production server, which runs on E.T, it was not retrieving the correct data! This was a major pain to debug, as the code itself was fine of course, and was solved with a single line of code:</p>
<blockquote><p>date_default_timezone_set(&#8220;GMT&#8221;);</p></blockquote>
<p>Place this at the start of any script that has a dependency on the server timezone, and you can port your code to any server regardless of its timezone. If you don&#8217;t know your server&#8217;s timezone, <a href="http://ie2.php.net/date_default_timezone_get">date_default_timezone_get()</a> will give it to you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pokeroconnor.com/server-timezones/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XPath and php starters</title>
		<link>http://www.pokeroconnor.com/xpath-and-php-starters/</link>
		<comments>http://www.pokeroconnor.com/xpath-and-php-starters/#comments</comments>
		<pubDate>Fri, 17 Apr 2009 21:36:57 +0000</pubDate>
		<dc:creator>PokerOConnor</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.pokeroconnor.com/?p=199</guid>
		<description><![CDATA[Quick starting point on XPath and php would be the W3C Xpath pages. All the syntax info you really need to build queries are there. One other example i found useful was this one. Then to use XPath with your php scripts, I use xpath(). A basic example would be the following (explained underneath) &#8211; say [...]]]></description>
			<content:encoded><![CDATA[<p>Quick starting point on XPath and php would be the <a href="http://www.w3schools.com/Xpath/xpath_intro.asp">W3C Xpath pages</a>. All the <a href="http://www.w3schools.com/Xpath/xpath_syntax.asp">syntax</a> info you really need to build queries are there. One other example i found useful was <a href="http://www.eggheadcafe.com/articles/20030627d.asp">this one</a>.</p>
<p>Then to use XPath with your php scripts, I use<a href="http://ie.php.net/manual/en/function.simplexml-element-xpath.php"> xpath()</a>. A basic example would be the following (explained underneath) &#8211; say you have an &lt;item&gt; node which has multiple &lt;title&gt; children nodes, and you want to get a list of all the first children &lt;title&gt; nodes from that xml doc, you could do this:</p>
<p>&lt;?php</p>
<p><span> </span>$xml = simplexml_load_file(&#8216;path/to/file/xml-file.xml&#8217;);</p>
<p>    $matches = $xml-&gt;xpath(&#8220;//item/title[1]&#8220;);</p>
<p>     foreach ($matches as $match){</p>
<p><span> </span>echo $match[0] . &#8220;&lt;br&gt;&#8221;;</p>
<p><span> </span></p>
<p>}</p>
<p>?&gt;</p>
<p>So firstly we use <a href="http://ie.php.net/simplexml_load_file">simplexml_load_file</a> to load our xml file. We then build the query, saying for every item element that appears anywhere in the xml file, select all title elements that are the first (the title elements that appear &#8216;top&#8217; in the list) children of item elements.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pokeroconnor.com/xpath-and-php-starters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

