<?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>Caneblu.com &#187; php</title>
	<atom:link href="http://www.caneblu.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.caneblu.com</link>
	<description>Solo un altro blog targato WordPress</description>
	<lastBuildDate>Mon, 10 May 2010 20:32:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Symfony: XSL module to install in Ubuntu</title>
		<link>http://www.caneblu.com/2010/05/symfony-xsl-module-to-install-in-ubuntu/</link>
		<comments>http://www.caneblu.com/2010/05/symfony-xsl-module-to-install-in-ubuntu/#comments</comments>
		<pubDate>Mon, 10 May 2010 20:22:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[symfony]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.caneblu.com/?p=144</guid>
		<description><![CDATA[Following the tutorial Simfony (known PHP Framework) to the preliminary pre-requisite, reflected the lack of XSL module under Apache and PHP. Specifically, the message I found was: &#91;&#91;WARNING&#93;&#93; XSL module is installed: FAILED *** Install the XSL module &#40;recommended for Propel&#41; *** The workaround is to install apt-get the missing modules as follows: sudo apt-get [...]]]></description>
			<content:encoded><![CDATA[<p>Following the tutorial Simfony (known PHP Framework) to the preliminary pre-requisite, reflected the lack of XSL module under Apache and PHP. Specifically, the message I found was:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000066; font-weight:bold;"><span style="">&#91;</span><span style="">&#91;</span>WARNING<span style="">&#93;</span><span style="">&#93;</span></span> XSL module is installed: FAILED
*** Install the XSL module <span style="">&#40;</span>recommended for Propel<span style="">&#41;</span> ***</pre></div></div>

<p>The workaround is to install apt-get the missing modules as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">sudo apt-get install libapache2-modxslt php5-xsl</pre></div></div>

<p>then restart the instance of Apache2</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">sudo / etc/init.d/apache2 restart</pre></div></div>

<p>Restarting the configuration check the error message should be gone.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.caneblu.com/2010/05/symfony-xsl-module-to-install-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress: add Google Buzz button</title>
		<link>http://www.caneblu.com/2010/02/wordpress-add-google-buzz-button/</link>
		<comments>http://www.caneblu.com/2010/02/wordpress-add-google-buzz-button/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 09:24:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Google]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tricks]]></category>

		<guid isPermaLink="false">http://www.caneblu.com/?p=130</guid>
		<description><![CDATA[Google Buzz is now on everyone&#8217;s lips for being anti Facebook situation. It&#8217;s time to exploit this situation to your blog, because the service is heavily oriented social network. Technically Google Buzz is largely integrated into Google Reader, the aggregator of RSS feeds, so we can exploit this relationship to create an appropriate button. You [...]]]></description>
			<content:encoded><![CDATA[<p>Google Buzz is now on everyone&#8217;s lips for being anti Facebook situation. It&#8217;s time to exploit this situation to your blog, because the service is heavily oriented social network. Technically Google Buzz is largely integrated into Google Reader, the aggregator of RSS feeds, so we can exploit this relationship to create an appropriate button. You only have to make sure that in your profile Buzz (above under the heading &#8220;connected sites&#8221;) has been added to Google Reader.</p>
<p>Obviously we must have a basic knowledge of PHP and WordPress system, but simply add a few lines in the right place, through the WordPress editor (in the Appearance -> Editor).</p>
<p>Here&#8217;s the code:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">&lt;a rel=”nofollow” target=”_blank” href=”http://www.google.com/reader/link?url=<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&amp;title=<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&amp;snippet=<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_excerpt<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&amp;srcURL=<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_settings<span style="color: #009900;">&#40;</span>‘home’<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>” Title=”Share this via Google Buzz&gt;&lt;img=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #0000ff;">&quot;&gt;/images/buzz-icon2.gif&quot;</span><span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span> Google Buzz</pre></td></tr></table></div>

<p>Also looking between the various utilities proposed in Google Reader you can add a small clip (bottom of the page under &#8220;Add a clip&#8221;) to your site, where &#8220;share&#8221; show your Buzz&#8217;s.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.caneblu.com/2010/02/wordpress-add-google-buzz-button/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fatal error: session_start(): Failed to initialize storage module:</title>
		<link>http://www.caneblu.com/2009/01/fatal-error-session_start-failed-to-initialize-storage-module/</link>
		<comments>http://www.caneblu.com/2009/01/fatal-error-session_start-failed-to-initialize-storage-module/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 17:14:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[hint]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.caneblu.com/caneblu/?p=27</guid>
		<description><![CDATA[If you get this error: Fatal error: session_start(): Failed to initialize storage module: The solution is changing your current php.ini settings for session.save_handler user to session.save_handler files. Edit your php.ini file from: [Session] ; Handler used to store/retrieve data. session.save_handler = user to [Session] ; Handler used to store/retrieve data. session.save_handler = files If you [...]]]></description>
			<content:encoded><![CDATA[<p>If you get this error:<br />
Fatal error: session_start(): Failed to initialize storage module:<br />
The solution is changing your current php.ini settings for session.save_handler user to session.save_handler files.</p>
<p>Edit your php.ini file from:</p>
<p><em> [Session]<br />
; Handler used to store/retrieve data.<br />
session.save_handler = user</em></p>
<p>to</p>
<p><em> [Session]<br />
; Handler used to store/retrieve data.<br />
session.save_handler = files</em></p>
<p>If you do not have access to the php.ini file, you may try an alternate .htaccess rewrite method. Edit your .htaccess and place the following lines:</p>
<p><em> RewriteEngine On<br />
php_value session.save_handler files</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.caneblu.com/2009/01/fatal-error-session_start-failed-to-initialize-storage-module/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Excel and PHP</title>
		<link>http://www.caneblu.com/2009/01/excel-and-php/</link>
		<comments>http://www.caneblu.com/2009/01/excel-and-php/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 17:12:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[howto]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[hint]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.caneblu.com/caneblu/?p=25</guid>
		<description><![CDATA[From Office 97 version, the World famous spreadsheet can read html table&#8217;s like a spreadsheet rows and colums. With this interesting feature we can create .xls file on the fly from php with a simple play of &#60;table&#62; html tag. Here the code 1 2 3 4 5 6 7 8 9 10 11 12 [...]]]></description>
			<content:encoded><![CDATA[<p>From Office 97 version, the World famous spreadsheet can read html table&#8217;s like a spreadsheet rows and colums.<br />
With this interesting feature we can create .xls file on the fly from php with a simple play of &lt;table&gt; html tag.</p>
<p>Here the code</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
    <span style="color: #000088;">$filename</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;spreadsheet.xls&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">header</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Type: application/vnd.ms-excel&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">header</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Content-Disposition: inline; filename=<span style="color: #006699; font-weight: bold;">$filename</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;My XLS title&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table border=&quot;0&quot;&gt;
<span style="color: #000000; font-weight: bold;">&lt;?</span>
    <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">100</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;tr&gt;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$j</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$j</span><span style="color: #339933;">&lt;</span><span style="color: #cc66cc;">100</span><span style="color: #339933;">;</span><span style="color: #000088;">$j</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$j</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;td&gt;<span style="color: #006699; font-weight: bold;">$a</span>&lt;/td&gt;&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/tr&gt;&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/table&gt;
&lt;/body&gt;&lt;/html&gt;</pre></td></tr></table></div>

<p>With line 3 we exchange the html data to excel<br />
With line 4 we download the file insted of open ino the browser</p>
<p>as you can see, you can play with the table and collect data from a database, for generate some .xls spreadsheet on the fly, with the data you want for specific user, or specific situations.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.caneblu.com/2009/01/excel-and-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL sample connection</title>
		<link>http://www.caneblu.com/2009/01/mysql-sample-connection/</link>
		<comments>http://www.caneblu.com/2009/01/mysql-sample-connection/#comments</comments>
		<pubDate>Sun, 04 Jan 2009 17:07:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Mysql]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.caneblu.com/caneblu/?p=23</guid>
		<description><![CDATA[Pre-requisites: Database host or IP Database name Username and password access of db. First we need to declare some critical data like username and password, so i strongly recommended to store this value into a different file where php will ask tables and data, this for security reason. In the php convension, usually we make [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Pre-requisites:</strong><br />
Database host or IP<br />
Database name<br />
Username and password access of db.</p>
<p>First we need to declare some critical data like username and password, so i strongly recommended to store this value into a different file where php will ask tables and data, this for security reason.</p>
<p>In the php convension, usually we make a file called config.inc.php, because the .inc between the file name and real extension, dont show nothing if directly called to your browser.</p>
<p>Let&#8217;s make this file usually called config.inc.php</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">      <span style="color: #000000; font-weight: bold;">&lt;?php</span>
      <span style="color: #666666; font-style: italic;">//database parameters</span>
      <span style="color: #000088;">$db_host</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//usually localhost, but can be an IP</span>
      <span style="color: #000088;">$db_user</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;myusername&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$db_password</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;mypassword&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$db_name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;mydatabasename&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Now we must pass to php this values, if you are planning a project, usually is a good idea to make next step to a file called database.php and perform the connection.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">      <span style="color: #000000; font-weight: bold;">&lt;?php</span>
      <span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;config.inc.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">//now check our usr/pass credentials</span>
      <span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$db_host</span><span style="color: #339933;">,</span> <span style="color: #000088;">$db_user</span><span style="color: #339933;">,</span> <span style="color: #000088;">$db_password</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$db</span> <span style="color: #339933;">==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span>
      <span style="color: #990000;">die</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;put here an error message&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
      <span style="color: #666666; font-style: italic;">//now we see if database name can be read/write</span>
      <span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$db_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$db</span><span style="color: #009900;">&#41;</span>
      or <span style="color: #990000;">die</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;ERROR: your parameteres are wrong&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>With <em>mysql_connect</em> your have ask a connection to database server with your username and password, usually on shared service, your credentials give access to one database, so the server must reply if you have a valid account on it. Be careful, the variables <em>$db_host, $db_user, $db_password</em> must be passed in the order of example above.</p>
<p>With <em>mysq_select_db</em> you ask the permission to read/write on database name, with previous credentials.<br />
Both functions are native PHP functions, and they can perform only a TRUE or FALSE, no database data is exchanged yet.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.caneblu.com/2009/01/mysql-sample-connection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
