<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Php – Yeri Tiete</title>
    <link>https://yeri.be/tag/php/</link>
    <description>Yeri Tiete&#39;s blog</description>
    <language>en</language>
    <copyright>© Yeri Tiete</copyright>
    <lastBuildDate>Wed, 09 Feb 2011 09:55:45 +0100</lastBuildDate>
    <atom:link href="https://yeri.be/tag/php/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Call to undefined function http_post_data()</title>
      <link>https://yeri.be/call-to-undefined-function-http_post_data/</link>
      <pubDate>Wed, 09 Feb 2011 09:55:45 +0100</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/call-to-undefined-function-http_post_data/</guid>
      <description>&lt;p&gt;After updating &lt;a href=&#34;https://web.archive.org/web/20110213161611/http://vm1.rootspirit.com:80/&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;my server&lt;/a&gt; from testing to Squeeze it suddenly crashed after running a high CPU % perl script.&lt;/p&gt;&#xA;&lt;p&gt;Being unresponsive I reset the machine to reboot it.&lt;/p&gt;&#xA;&lt;p&gt;After booting up and testing websites running on it I came along an odd PHP error;&lt;/p&gt;&#xA;&lt;pre style=&#34;background-color: #ffffff; line-height: 12pt; margin-right: 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 35px; border: 1px dashed #489e06;&#34;&gt;Call to undefined function http_post_data()&lt;/pre&gt;&#xA;&lt;p&gt;Probably due to PHP updates from Lenny/testing to Squeeze.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>After updating <a href="https://web.archive.org/web/20110213161611/http://vm1.rootspirit.com:80/" target="_blank" rel="noopener">my server</a> from testing to Squeeze it suddenly crashed after running a high CPU % perl script.</p>
<p>Being unresponsive I reset the machine to reboot it.</p>
<p>After booting up and testing websites running on it I came along an odd PHP error;</p>
<pre style="background-color: #ffffff; line-height: 12pt; margin-right: 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 35px; border: 1px dashed #489e06;">Call to undefined function http_post_data()</pre>
<p>Probably due to PHP updates from Lenny/testing to Squeeze.</p>
<p>This error is caused by not having installed PECL-HTTP (and <span style="font-family: Verdana, Arial, 'Bitstream Vera Sans', Helvetica, sans-serif; line-height: normal;">php-pear php5-dev libcurl3-openssl-dev)</span></p>
<p><span style="font-family: Verdana, Arial, 'Bitstream Vera Sans', Helvetica, sans-serif; line-height: normal;">However, PECL-HTTP had been installed for ages and running the pecl install command resulted in this:</span></p>
<pre style="background-color: #ffffff; line-height: 12pt; margin-right: 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 35px; border: 1px dashed #489e06;"># pecl install pecl_http
pecl/pecl_http is already installed and is the same as the released version 1.7.0
install failed</pre>
<p>Some quick Googling didn&rsquo;t come up with a simple fix.</p>
<p>I then tried to reinstall PECL-HTTP (by uninstalling and reinstalling it)</p>
<pre style="background-color: #ffffff; line-height: 12pt; margin-right: 5px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 35px; border: 1px dashed #489e06;"># pecl uninstall pecl_http
Unable to remove "extension=http.so" from php.ini
uninstall ok: channel://pecl.php.net/pecl_http-1.7.0
# pecl install pecl_http
downloading pecl_http-1.7.0.tgz ...
Starting to download pecl_http-1.7.0.tgz (173,979 bytes)
[...]</pre>
<p>Which luckily did solve my issue&hellip;</p>
<p>So reinstalling does actually solve stuff on Linux :x</p>
<p>Be sure to have extension=http.so in your php.ini and to restart php if it&rsquo;s running with fastcgi or restarting Apache after making the changes.</p>
]]></content:encoded>
      <category>errors</category><category>linux</category><category>software</category><category>www</category>
      <category>nginx</category><category>php</category>
    </item>
    
    <item>
      <title>nginx &#43; fastcgi PHP</title>
      <link>https://yeri.be/nginx-fastcgi-php/</link>
      <pubDate>Sun, 21 Mar 2010 01:32:21 +0100</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/nginx-fastcgi-php/</guid>
      <description>&lt;p&gt;I recently migrated &lt;a href=&#34;https://web.archive.org/web/20110213161611/http://vm1.rootspirit.com:80/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;vm1&lt;/a&gt; to &lt;a href=&#34;http://nginx.org/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;nginx&lt;/a&gt; instead of lighttpd. Just for the sake of playing and testing around.&lt;/p&gt;&#xA;&lt;p&gt;As there&amp;rsquo;s a PHP page as well, I had to set up fastcgi with PHP. I mainly followed &lt;a href=&#34;https://web.archive.org/web/20160310072932/http://tomasz.sterna.tv:80/2009/04/php-fastcgi-with-nginx-on-ubuntu&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;this tutorial&lt;/a&gt; to try to get PHP working.&lt;/p&gt;&#xA;&lt;p&gt;However, every PHP page I visited returned following error:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-bash&#34; data-lang=&#34;bash&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;No input file specified.&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As I was fairly sure it was path (or variable) related, I played around with:&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I recently migrated <a href="https://web.archive.org/web/20110213161611/http://vm1.rootspirit.com:80/" target="_blank" rel="noopener noreferrer">vm1</a> to <a href="http://nginx.org/" target="_blank" rel="noopener noreferrer">nginx</a> instead of lighttpd. Just for the sake of playing and testing around.</p>
<p>As there&rsquo;s a PHP page as well, I had to set up fastcgi with PHP. I mainly followed <a href="https://web.archive.org/web/20160310072932/http://tomasz.sterna.tv:80/2009/04/php-fastcgi-with-nginx-on-ubuntu" target="_blank" rel="noopener noreferrer">this tutorial</a> to try to get PHP working.</p>
<p>However, every PHP page I visited returned following error:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">No input file specified.
</span></span></code></pre></div><p>As I was fairly sure it was path (or variable) related, I played around with:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">fastcgi_param   SCRIPT_FILENAME  <span class="nv">$document_root$fastcgi_script_name</span><span class="p">;</span>
</span></span></code></pre></div><p>Changing $document_root to the full path, etc, without success.</p>
<p>However, as I used the init script in the tutorial, and <a href="https://web.archive.org/web/20120225104936/http://forum.slicehost.com:80/comments.php?DiscussionID=1259" target="_blank" rel="noopener noreferrer">read a few posts</a> about possible permission errors, I tried adding the group to the fastcgi daemon starter as well.</p>
<p>Change this:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">start-stop-daemon --quiet --start --background --chuid <span class="s2">&#34;</span><span class="nv">$USER</span><span class="s2">&#34;</span> --exec /usr/bin/env -- <span class="nv">$PHP_CGI_ARGS</span>
</span></span></code></pre></div><p>to:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">start-stop-daemon --quiet --start --background --chuid <span class="s2">&#34;</span><span class="nv">$USER</span><span class="s2">&#34;</span> -g www-data --exec /usr/bin/env -- <span class="nv">$PHP_CGI_ARGS</span>
</span></span></code></pre></div><p>Notice the &ldquo;-g www-data&rdquo; part.</p>
<p>You can always make a variable in case you ever want to edit it.</p>
<p>Restart php_fastcgi and try again. Should work fine now.</p>
<p>Some fast stats: <a href="https://static.yeri.be/2010/03/nginx.vm1_.txt" target="_blank" rel="noopener noreferrer">vm1 + nginx</a>, <a href="https://static.yeri.be/2010/03/lighttpd.vm1_.txt" target="_blank" rel="noopener noreferrer">vm1 + lighttpd</a>, <a href="https://static.yeri.be/2010/03/IIS7.vm0_.txt" target="_blank" rel="noopener noreferrer">vm0 + IIS7</a>, <a href="https://static.yeri.be/2010/03/apache.one_.txt" target="_blank" rel="noopener noreferrer">one + Apache</a>, vm1 + nginx + PHP and <a href="https://static.yeri.be/2010/03/apache.one_.php_.txt" target="_blank" rel="noopener noreferrer">one + Apache + PHP</a>.</p>
<p>These stats should only give a quick overview. To get correct results it should be ran on the same hardware, at the same moment with the same load, and 100% the same pages.</p>
<p>&ldquo;One&rdquo; is a Gentoo dual Pentium III with 1.2Gb ram, &ldquo;vm0&rdquo; is a Windows 2008 Xen Virtual machine with 1 Gb ram, and has access to two vCPUs (Xeon), &ldquo;vm1&rdquo; is a Debian with 128Mb ram, and also access to two vCPUs (Xeon). Nginx wins on static content (followed by Lighttpd). Apache wins by a little over nginx on PHP content in these tests.</p>
<p><a href="https://web.archive.org/web/20120703003237/http://blog.webfaction.com:80/a-little-holiday-present" target="_blank" rel="noopener noreferrer">Here</a>&rsquo;s another site with some stats.</p>
]]></content:encoded>
      <category>errors</category><category>linux</category><category>software</category><category>www</category>
      <category>nginx</category><category>php</category>
    </item>
    
    <item>
      <title>uptimed php file</title>
      <link>https://yeri.be/uptimed-php-file/</link>
      <pubDate>Wed, 10 Feb 2010 17:08:58 +0100</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/uptimed-php-file/</guid>
      <description>&lt;p&gt;If you&amp;rsquo;re running &lt;a href=&#34;https://web.archive.org/web/20150328234734/http://podgorny.cz:80/moin/Uptimed&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;uptimed&lt;/a&gt; (or uprecords) and what to display it in a simple php page, you&amp;rsquo;ll notice the bold text makes the page somewhat ugly.&lt;/p&gt;&#xA;&lt;p&gt;Use &lt;a href=&#34;https://static.yeri.be/2010/02/uptime.php_.tar&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;this&lt;/a&gt; file to remove the bold chars and make it readable.&lt;/p&gt;&#xA;&lt;p&gt;Examples: &lt;a href=&#34;http://uptime.rootspirit.com/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;zero&lt;/a&gt;, &lt;a href=&#34;https://web.archive.org/web/20070330014525/http://uptime1.rootspirit.com:80/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;one&lt;/a&gt;, &lt;a href=&#34;http://four.rootspirit.com/up/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;four&lt;/a&gt;, &lt;a href=&#34;http://vm1.rootspirit.com/uptime.php&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;vm1&lt;/a&gt;, &lt;a href=&#34;https://web.archive.org/web/20090914050359/http://home.tiete.be:80/uptime/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Sauron&lt;/a&gt;&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>If you&rsquo;re running <a href="https://web.archive.org/web/20150328234734/http://podgorny.cz:80/moin/Uptimed" target="_blank" rel="noopener noreferrer">uptimed</a> (or uprecords) and what to display it in a simple php page, you&rsquo;ll notice the bold text makes the page somewhat ugly.</p>
<p>Use <a href="https://static.yeri.be/2010/02/uptime.php_.tar" target="_blank" rel="noopener noreferrer">this</a> file to remove the bold chars and make it readable.</p>
<p>Examples: <a href="http://uptime.rootspirit.com/" target="_blank" rel="noopener noreferrer">zero</a>, <a href="https://web.archive.org/web/20070330014525/http://uptime1.rootspirit.com:80/" target="_blank" rel="noopener noreferrer">one</a>, <a href="http://four.rootspirit.com/up/" target="_blank" rel="noopener noreferrer">four</a>, <a href="http://vm1.rootspirit.com/uptime.php" target="_blank" rel="noopener noreferrer">vm1</a>, <a href="https://web.archive.org/web/20090914050359/http://home.tiete.be:80/uptime/" target="_blank" rel="noopener noreferrer">Sauron</a></p>
]]></content:encoded>
      <category>hardware</category><category>linux</category><category>software</category><category>www</category>
      <category>php</category><category>uprecords</category><category>uptimed</category>
    </item>
    
    <item>
      <title>Agenda / Todo page</title>
      <link>https://yeri.be/agenda-todo-page/</link>
      <pubDate>Tue, 09 Feb 2010 13:29:35 +0100</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/agenda-todo-page/</guid>
      <description>&lt;p&gt;This summer I created a simple &amp;ldquo;agenda&amp;rdquo; for myself. I&amp;rsquo;ve been using it every now &amp;amp; then, but forgot to &amp;ldquo;share&amp;rdquo; it. So here it goes.&lt;/p&gt;&#xA;&lt;p&gt;Screenshots below&lt;/p&gt;&#xA;&lt;p&gt;&lt;strong&gt;Features&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;    &lt;li&gt;Add todo items&lt;/li&gt;&#xA;    &lt;li&gt;Change todo items to completed&lt;/li&gt;&#xA;    &lt;li&gt;List of (completed) todo items&lt;/li&gt;&#xA;    &lt;li&gt;PHP + MySQL&lt;/li&gt;&#xA;    &lt;li&gt;Basic &lt;a href=&#34;http://prowl.weks.net/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Prowl&lt;/a&gt; support&lt;/li&gt;&#xA;    &lt;li&gt;Example SQL &lt;a href=&#34;https://yeri.be/8g&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;create script&lt;/a&gt;&lt;/li&gt;&#xA;    &lt;li style=&#34;text-align: left;&#34;&gt;There&#39;s NO login. Use &lt;a href=&#34;http://www.javascriptkit.com/howto/htaccess3.shtml&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;.htaccess files&lt;/a&gt; to disable world wide access.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;&lt;strong&gt;Screenshots&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;p style=&#34;text-align: center;&#34;&gt;&lt;a href=&#34;https://static.yeri.be/2010/02/Screen-shot-2010-02-08-at-13.27.49.png&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;img class=&#34;size-medium wp-image-951 aligncenter&#34; title=&#34;Todo list&#34; src=&#34;https://static.yeri.be/2010/02/Screen-shot-2010-02-08-at-13.27.49-300x194.png&#34; alt=&#34;&#34; width=&#34;300&#34; height=&#34;194&#34; /&gt;&lt;/a&gt;&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>This summer I created a simple &ldquo;agenda&rdquo; for myself. I&rsquo;ve been using it every now &amp; then, but forgot to &ldquo;share&rdquo; it. So here it goes.</p>
<p>Screenshots below</p>
<p><strong>Features</strong>:</p>
<ul>
    <li>Add todo items</li>
    <li>Change todo items to completed</li>
    <li>List of (completed) todo items</li>
    <li>PHP + MySQL</li>
    <li>Basic <a href="http://prowl.weks.net/" target="_blank" rel="noopener noreferrer">Prowl</a> support</li>
    <li>Example SQL <a href="https://yeri.be/8g" target="_blank" rel="noopener noreferrer">create script</a></li>
    <li style="text-align: left;">There's NO login. Use <a href="http://www.javascriptkit.com/howto/htaccess3.shtml" target="_blank" rel="noopener noreferrer">.htaccess files</a> to disable world wide access.</li>
</ul>
<p><strong>Screenshots</strong>:</p>
<p style="text-align: center;"><a href="https://static.yeri.be/2010/02/Screen-shot-2010-02-08-at-13.27.49.png" target="_blank" rel="noopener noreferrer"><img class="size-medium wp-image-951 aligncenter" title="Todo list" src="https://static.yeri.be/2010/02/Screen-shot-2010-02-08-at-13.27.49-300x194.png" alt="" width="300" height="194" /></a></p>
<p style="text-align: center;"><a href="https://static.yeri.be/2010/02/Screen-shot-2010-02-08-at-13.28.04.png" target="_blank" rel="noopener noreferrer"><img class="size-medium wp-image-952 aligncenter" title="Add todo item" src="https://static.yeri.be/2010/02/Screen-shot-2010-02-08-at-13.28.04-300x87.png" alt="" width="300" height="87" /></a></p>
<p style="text-align: center;"><a href="https://static.yeri.be/2010/02/Screen-shot-2010-02-08-at-13.28.31.png" target="_blank" rel="noopener noreferrer"><img class="size-medium wp-image-953 aligncenter" title="Archive" src="https://static.yeri.be/2010/02/Screen-shot-2010-02-08-at-13.28.31-300x154.png" alt="" width="300" height="154" /></a></p>
<p style="text-align: left;"><strong>Download</strong>:</p>
<p style="text-align: left;"><a href="https://static.yeri.be/2010/02/todo.tar" target="_blank" rel="noopener noreferrer">version 0.1</a></p>
<p style="text-align: left;">Feel free to edit and use this simple agenda however you want.</p>
]]></content:encoded>
      <category>misc</category><category>www</category>
      <category>agenda</category><category>mysql</category><category>php</category><category>todo</category>
    </item>
    
  </channel>
</rss>
