<?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>Tim Keller &#187; BSD</title>
	<atom:link href="http://timkeller.me/tag/bsd/feed/" rel="self" type="application/rss+xml" />
	<link>http://timkeller.me</link>
	<description>Thoughts on Technology and the future of Learning</description>
	<lastBuildDate>Sun, 15 Jan 2012 21:14:27 +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>PHP+MySQL from the Mac OSX Terminal</title>
		<link>http://timkeller.me/2008/07/13/phpmysql-from-the-mac-osx-terminal/</link>
		<comments>http://timkeller.me/2008/07/13/phpmysql-from-the-mac-osx-terminal/#comments</comments>
		<pubDate>Sun, 13 Jul 2008 10:24:00 +0000</pubDate>
		<dc:creator>Tim Keller</dc:creator>
				<category><![CDATA[Articles]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[BSD]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Sockets]]></category>
		<category><![CDATA[xampp]]></category>

		<guid isPermaLink="false">http://tumble.timokeller.net/post/42082031</guid>
		<description><![CDATA[I had to write a CLI PHP script today as part of the job-parser for the SMS module in ChirpSchool. The parser executes every 5 minutes as a cron-job and dispatches waiting messages in the Message Queue. I ran into &#8230; <a href="http://timkeller.me/2008/07/13/phpmysql-from-the-mac-osx-terminal/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I had to write a CLI PHP script today as part of the job-parser for the SMS module in ChirpSchool. The parser executes every 5 minutes as a cron-job and dispatches waiting messages in the Message Queue.</p>
<p>I ran into a small problem in that the Command-Line-Interface PHP binary was different to the one running on my Apache+Mysql+PHP stack so the CLI PHP didn&#8217;t know which MySQL socket to attach to:</p>
<blockquote>
<p>Warning: mysqli_connect(): (HY000/2002): Can&#8217;t connect to local MySQL server through socket &#8216;/var/mysql/mysql.sock&#8217;</p>
</blockquote>
<p>The solution is simple. I am using Mac OSX 10.5.4 Leopard and XAMPP.</p>
<ol>
<li>Find out which PHP you are using from the terminal by typing &#8216;whereis php&#8217;. It is no doubt /usr/bin/php. <br/>
</li>
<li>Create a php.ini in /etc. Type &#8216;sudo cp /etc/php.ini.default /etc/php.ini</li>
<li>Then open this new file in something&#8230; I did a &#8216;sudo nano /etc/php.ini&#8217;.</li>
<li>Edit the mysqli.default_socket parameter (or mysql if you aren&#8217;t using the new improved driver) to point to the MySQL socket Apache is using. Mine was at /Applications/xampp/xamppfiles/var/mysql/mysql.sock (your&#8217;s may be at  /tmp/mysql.sock)</li>
<li>Be sure to save this new php.ini. Remember, /etc is protected so you won&#8217;t be able to save the file unless you have sudo&#8217;d yourself admin rights.<br/>
</li>
<li>Commenter<b> ferzkopp</b> kindly reminds us that an Apache restart may be neccesary to get this activated. Thanks for the Tip! </li>
</ol>
<p>Hope this helps!</p>
]]></content:encoded>
			<wfw:commentRss>http://timkeller.me/2008/07/13/phpmysql-from-the-mac-osx-terminal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

