<?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"
	>

<channel>
	<title>Black-ops</title>
	<atom:link href="http://jdlawrie.co.uk/blogs/black-ops/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://jdlawrie.co.uk/blogs/black-ops</link>
	<description>A place to share technical solutions</description>
	<pubDate>Mon, 15 Feb 2010 20:26:20 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Error establishing a database connection: Wordpress</title>
		<link>http://jdlawrie.co.uk/blogs/black-ops/?p=8</link>
		<comments>http://jdlawrie.co.uk/blogs/black-ops/?p=8#comments</comments>
		<pubDate>Mon, 28 Jul 2008 21:11:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Ubuntu]]></category>

		<category><![CDATA[database]]></category>

		<category><![CDATA[error establishing a database connection]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[unable to connect to database]]></category>

		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://jdlawrie.co.uk/blogs/black-ops/?p=8</guid>
		<description><![CDATA[This issue is mostly well documented elsewhere on the internet, but I recently found an unusual cause of this problem which I felt was worth documenting.
The following list should hopefully help you to isolate this problem, but if I&#8217;ve missed anything please let me know via comments:

Firstly check you have updated the DB_USER, DB_PASSWORD and [...]]]></description>
			<content:encoded><![CDATA[<p>This issue is mostly well documented elsewhere on the internet, but I recently found an unusual cause of this problem which I felt was worth documenting.</p>
<p>The following list should hopefully help you to isolate this problem, but if I&#8217;ve missed anything please let me know via comments:</p>
<ul>
<li>Firstly check you have updated the DB_USER, DB_PASSWORD and possibly DB_HOST in your wp-config.php file.</li>
<li>Next, check the database is actually up and running. If you get a response from &#8216;mysql -u root -h DB_HOST -p&#8217; then the database is running. (Replace DB_HOST with its value).</li>
<li>Once you have logged into mysql as root (or with sufficient privileges) ensure the database is configured with the correct access rights with the following query (replacing DB_NAME, DB_USER, DB_HOST and DB_PASSWORD): <code>GRANT ALL ON DB_NAME.* TO 'DB_USER'@'DB_HOST' IDENTIFIED BY 'DB_PASSWORD'; FLUSH PRIVILEGES;</code></li>
<li>If you are having an issue where every time you go through these steps to configure one blog, another one throws this error in a vicious circle ensure that you don&#8217;t have two or more blogs all relying on the same DB_USER but different DB_PASSWORDs (even if you are using different DB_NAMEs) as every time you update the privileges for one password, you are effectively changing the password for that DB_USER, so any wp-config.php using that username but a different password will be unable to access the database.</li>
</ul>
<p>Hopefully this will help at least one person.</p>
]]></content:encoded>
			<wfw:commentRss>http://jdlawrie.co.uk/blogs/black-ops/?feed=rss2&amp;p=8</wfw:commentRss>
		</item>
		<item>
		<title>Use PHP to text you everytime you get a new email</title>
		<link>http://jdlawrie.co.uk/blogs/black-ops/?p=7</link>
		<comments>http://jdlawrie.co.uk/blogs/black-ops/?p=7#comments</comments>
		<pubDate>Mon, 07 Jul 2008 12:51:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[alert]]></category>

		<category><![CDATA[crontab]]></category>

		<category><![CDATA[gmail]]></category>

		<category><![CDATA[IMAP]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[SMS]]></category>

		<category><![CDATA[text message]]></category>

		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://jdlawrie.co.uk/blogs/black-ops/?p=7</guid>
		<description><![CDATA[This tutorial explains how to connect to gmail with php, and have an SMS alert sent to your mobile phone using Twitter every time you receive a new email. I used PHP 5.2.3 on Ubuntu 7.10 with MySQL 5.0.45 , but other combinations may work.
Firstly you need to open two twitter accounts (there is probably [...]]]></description>
			<content:encoded><![CDATA[<p>This tutorial explains how to connect to gmail with php, and have an SMS alert sent to your mobile phone using Twitter every time you receive a new email. I used PHP 5.2.3 on Ubuntu 7.10 with MySQL 5.0.45 , but other combinations may work.</p>
<p>Firstly you need to open two <a title="Twitter" href="http://twitter.com" target="_blank">twitter</a> accounts (there is probably a way to do it with just one, but I already had one open so I used that): The first account (say &#8216;account1&#8242;) should be your main account and you should follow the introductory instructions to register your mobile phone with the account (it&#8217;s free, as is receiving text messages). The second account (&#8217;account2&#8242;) should be set to private feeds (you don&#8217;t want everyone being able to read your email). Login to &#8216;account1&#8242; and follow &#8216;account2&#8242;, then login to &#8216;account2&#8242; and accept the request. Finally, text &#8220;ON account2&#8243; to twitter from your registered mobile number. Twitter is now setup for the script to work.</p>
<p>Next ensure gmail is configured to allow IMAP connections to your account by logging in, and ensuring IMAP is enabled in Settings-&gt;Forwarding and POP3/IMAP.</p>
<p>Now we need a database to store email IDs in (so you don&#8217;t get alerted about the same email twice). Also we create a second table here to hold the most recently updated status - this is because Twitter won&#8217;t allow a status update that is the same as the last status, but you might receive two emails with the same subject (especially if you are having a gmail conversation) so if the status matches the previous status a hyphen is appended just to make it unique.</p>
<blockquote><p>mysql -u root -p<br />
CREATE DATABASE Email;<br />
USE Email;<br />
CREATE TABLE TwitterEmail(email VARCHAR(20), id VARCHAR(980), PRIMARY KEY (email, id));<br />
CREATE TABLE TwitterSubject (email varchar(20) PRIMARY KEY NOT NULL, last_subject text, FOREIGN KEY(email) REFERENCES TwitterEmail(email));<br />
GRANT ALL TO &#8216;db_user&#8217;@'localhost&#8217; IDENTIFIED BY &#8216;db_password&#8217;;<br />
EXIT;</p></blockquote>
<p>Save <a title="Email2Twitter.php" href="http://jdlawrie.co.uk/blogs/black-ops/openSource/Email2Twitter.php5" target="_blank">Email2Twitter.php</a> into /home/user/ and ensure it is executable by you but not readable by anyone else (as it has your passwords in it):</p>
<blockquote><p>chmod 700 Email2Twitter.php<br />
which php # note the output here as we need it for crontab in a second<br />
crontab -e</p></blockquote>
<p>In the nano window that comes up, add a new crontab entry to run the program as often as you&#8217;d like, making sure to specify the full path of both php and Email2Twitter.php. For example:</p>
<blockquote><p>00 * * * * /usr/bin/php /home/username/Email2Twitter.php</p></blockquote>
<p>The above example will cause the program to run once an hour providing that machine stays turned on.</p>
<p>Troubleshooting:<br />
If the machine can&#8217;t find &#8216;php&#8217;, ensure that php5-cli is installed. Likewise, if you get an error message complaining about IMAP functions not being found ensure php5-imap is installed.<br />
I had a program running this script on one machine where it had trouble connecting to imap.gmail.com yet I could still telnet to it (so the firewall wasn&#8217;t causing the problem). If anyone can suggest why this particular machine was causing an issue it would be very much appreciated.</p>
<p>All comments, suggestions and corrections welcome.</p>
<p>UPDATE: Due to a <a href="http://blog.twitter.com/2008/08/changes-for-some-sms-usersgood-and-bad.html" target="_blank">change in the service offered by Twitter</a>, this no longer works unless you are in the United States, Canada or India. It&#8217;s quite obvious this was coming as their SMS deliveries have been unreliable to say the least over the past months.</p>
<p>When I have time I&#8217;ll look into another free way of doing this (it may not be possible), and soon I&#8217;m planning on writing about controlling a linux machine using a mobile phone via Twitter (which should still work).</p>
]]></content:encoded>
			<wfw:commentRss>http://jdlawrie.co.uk/blogs/black-ops/?feed=rss2&amp;p=7</wfw:commentRss>
		</item>
		<item>
		<title>Installing Wordpress on Ubuntu 7.10</title>
		<link>http://jdlawrie.co.uk/blogs/black-ops/?p=5</link>
		<comments>http://jdlawrie.co.uk/blogs/black-ops/?p=5#comments</comments>
		<pubDate>Mon, 19 May 2008 21:00:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Ubuntu]]></category>

		<category><![CDATA[7.10]]></category>

		<category><![CDATA[gutsy]]></category>

		<category><![CDATA[install]]></category>

		<category><![CDATA[installation]]></category>

		<category><![CDATA[ubuntu]]></category>

		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://jdlawrie.co.uk/blogs/black-ops/?p=5</guid>
		<description><![CDATA[The idea of this blog is to detail solutions to anything technical I&#8217;ve tried that hasn&#8217;t been straightforward. What better way to start than with instructions on installing wordpress:
Instructions for Ubuntu 7.10 using bash, but should be similar for any *nix install.
Assuming the following:

LAMP server already installed,
Installation is for a single blog,
The blog should be [...]]]></description>
			<content:encoded><![CDATA[<p>The idea of this blog is to detail solutions to anything technical I&#8217;ve tried that hasn&#8217;t been straightforward. What better way to start than with instructions on installing wordpress:</p>
<p>Instructions for Ubuntu 7.10 using bash, but should be similar for any *nix install.</p>
<p>Assuming the following:</p>
<ul>
<li>LAMP server already installed,</li>
<li>Installation is for a single blog,</li>
<li>The blog should be in the root directory of the website, eg. domain.com,</li>
<li>The root directory is located in /var/www/</li>
</ul>
<p>Downloading and extracting the latest version:</p>
<blockquote><p>sudo su<br />
cd /tmp/<br />
wget http://wordpress.org/latest.tar.gz<br />
tar -xzvf latest.tar.gz<br />
mv wordpress/* /var/www/<br />
cd /var/www/</p></blockquote>
<p>Configuring the mysql database:</p>
<blockquote>
<p style="text-align: left;">mysql -u root -p<br />
CREATE DATABASE wordpress;<br />
GRANT ALL PRIVILEGES ON wordpress.* TO &#8216;wordpress&#8217;@'localhost&#8217; IDENTIFIED BY &#8217;somepassword&#8217;;<br />
FLUSH PRIVILEGES;<br />
EXIT;</p>
</blockquote>
<p>Moving the default config file:</p>
<blockquote>
<p style="text-align: left;">mv wp-config-sample.php wp-config.php<br />
nano wp-config</p>
</blockquote>
<p>Change it to look like this:</p>
<blockquote><p>define(&#8217;DB_NAME&#8217;, &#8216;wordpress&#8217;);<br />
define(&#8217;DB_USER&#8217;, &#8216;wordpress&#8217;);<br />
define(&#8217;DB_PASSWORD&#8217;, &#8217;somePassword&#8217;);<br />
define(&#8217;SECRET_KEY&#8217;, &#8216;make this unique!&#8217;);</p></blockquote>
<p>Next go to yourhostname.com/wp-admin/install.php and follow the steps. Once you have logged in it should take you to a configuration portal and yourhostname.com should be your blog - have fun!</p>
<p>If you get a directory listing instead of a portal, you need to ensure apache is configured to recognise index.php as an index file. Ensure the /etc/apache2/httpd.conf (or the vhost configuration file if you are using one) looks something like this:</p>
<blockquote><p>DirectoryIndex index.php index.html index.htm</p></blockquote>
<p>If you had to change this file, you need to reload apache:</p>
<blockquote><p>/etc/init.d/apache2 reload</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://jdlawrie.co.uk/blogs/black-ops/?feed=rss2&amp;p=5</wfw:commentRss>
		</item>
	</channel>
</rss>
