Categories
Errors Linux Software www

Call to undefined function http_post_data()

After updating my server from testing to Squeeze it suddenly crashed after running a high CPU % perl script.

Being unresponsive I reset the machine to reboot it.

After booting up and testing websites running on it I came along an odd PHP error;

Call to undefined function http_post_data()

Probably due to PHP updates from Lenny/testing to Squeeze.

This error is caused by not having installed PECL-HTTP (and php-pear php5-dev libcurl3-openssl-dev)

However, PECL-HTTP had been installed for ages and running the pecl install command resulted in this:

# pecl install pecl_http
pecl/pecl_http is already installed and is the same as the released version 1.7.0
install failed

Some quick Googling didn’t come up with a simple fix.

I then tried to reinstall PECL-HTTP (by uninstalling and reinstalling it)

# 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)
[...]

Which luckily did solve my issue…

So reinstalling does actually solve stuff on Linux 😡

Be sure to have extension=http.so in your php.ini and to restart php if it’s running with fastcgi or restarting Apache after making the changes.

Categories
Errors Linux Software www

nginx + fastcgi PHP

I recently migrated vm1 to nginx instead of lighttpd. Just for the sake of playing and testing around.

As there’s a PHP page as well, I had to set up fastcgi with PHP. I mainly followed this tutorial to try to get PHP working.

However, every PHP page I visited returned following error:

No input file specified.

As I was fairly sure it was path (or variable) related, I played around with:

fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;

Changing $document_root to the full path, etc, without success.

However, as I used the init script in the tutorial, and read a few posts about possible permission errors, I tried adding the group to the fastcgi daemon starter as well.

Change this:

start-stop-daemon --quiet --start --background --chuid "$USER" --exec /usr/bin/env -- $PHP_CGI_ARGS

to:

start-stop-daemon --quiet --start --background --chuid "$USER" -g www-data --exec /usr/bin/env -- $PHP_CGI_ARGS

Notice the “-g www-data” part.

You can always make a variable in case you ever want to edit it.

Restart php_fastcgi and try again. Should work fine now.

Some fast stats: vm1 + nginx, vm1 + lighttpd, vm0 + IIS7one + Apache, vm1 + nginx + PHP and one + Apache + PHP.

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.

“One” is a Gentoo dual Pentium III with 1.2Gb ram, “vm0” is a Windows 2008 Xen Virtual machine with 1 Gb ram, and has access to two vCPUs (Xeon), “vm1” 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.

Here‘s another site with some stats.

Categories
Hardware Linux Software www

uptimed php file

If you’re running uptimed (or uprecords) and what to display it in a simple php page, you’ll notice the bold text makes the page somewhat ugly.

Use this file to remove the bold chars and make it readable.

Examples: zero, one, four, vm1, Sauron

Categories
Misc www

Agenda / Todo page

This summer I created a simple “agenda” for myself. I’ve been using it every now & then, but forgot to “share” it. So here it goes.

Screenshots below

Features:

  • Add todo items
  • Change todo items to completed
  • List of (completed) todo items
  • PHP + MySQL
  • Basic Prowl support
  • Example SQL create script
  • There’s NO login. Use .htaccess files to disable world wide access.

Screenshots:

Download:

version 0.1

Feel free to edit and use this simple agenda however you want.