Categories
PHP

php-security flash presentation

Good presentation by Chris Shiflett of “Brain Bulb”. The flash format makes it very accessible and allows for simple animation.

Categories
PHP

Migrating to Page Controllers

My experiences with page controllers and other design patterns has been mostly good, although sometimes it’s overkill! Nevertheless, this tutorial is worth a read if you’re interested, or haven’t a clue what I’m talking about!

Categories
PHP

Vim folding redux

Vim folding is so handy as Kae found out ages ago. I finally tried it again this morning..

Categories
PHP

Ootips – Object Orientation Tips

Ootips – Object Orientation Tips.. my primary development language these days is PHP, so my OO skills aren’t called upon as much as they used to. Still should be useful stuff here for everyone!

Categories
Development PHP Web

Behaviour : Using CSS selectors to apply Javascript behaviours

Lurvely! This is a very neat method for removing Javascript from html pages! Embed it in the CSS! (sort of!)
He has a couple of examples on his page, and it looks easy enough in principle. The devil’s in the details don’t you know but it looks like it’s worth trying!
He’s a busy beaver too.. he has an MVC framework and tutorial that steps you through an example.

Categories
PHP

PHP, happy 10th birthday

Jon noticed that PHP is 10 years old today! I’ve been working with PHP for the last 6 or so years.. has it been that long?

Categories
Linux WordPress

Debian Sarge, PHP4 and Apache2.. why do you persecute me?

Oh FFS! Has anyone had a problem with Apache2 and PHP4 on Debian Sarge/Testing? I have a stock install of it with nothing unusual AFAICT but Firefox keeps trying to download and save php files instead of processing them. All the config files seem to be correctly set up. Files in mods-enabled/ are fine.
Why am I upset? I added the wp-newblog.php to WPMU SVN tonight, imported a chunk of code from install.php so it’s a one-step process, but I can’t test this thing to see if it works! It’s here as a WPMU snapshot but it won’t work out of the box. It needs an entry in .htaccess first, and bug fixing.

I’m off to relax, it’s been a long day.. zzzz

Much Later… I finally got it working again. I tried dpkg-reconfigure phpmyadmin but it didn’t update the config file with this error:

Not replacing deleted config file /etc/apache2/conf.d/phpmyadmin.conf

Following the clues from here I did the following:

apt-get remove –purge libapache2-mod-php4
apt-get remove –purge apache2
apt-get install libapache2-mod-php4 phpmyadmin

PHPMyAdmin now works fine, and hopefully wpmu will too!

Categories
Asides PHP

XML/SWF Charts

Very nice XML/SWF Charts with a php backend library to feed data.

Categories
PHP Web

Lighttpd, fastcgi, php and eAccelerator

lighttpd is a lightweight httpd server I came across on #wordpress (thanks michel_v!)
It took a while but I got it working on a server and it’s rather nice. You can run php scripts through it using the fastcgi interface. Here’s how I installed it on a Debian machine. Lines starting with “#” are commands that should be entered as the root user. (lots ripped from this tutorial)

# wget http://www.lighttpd.net/download/lighttpd-1.3.13.tar.gz
# tar zxvf lighttpd-1.3.13.tar.gz
# cd lighttpd-1.3.13
# dpkg-buildpackage

dpkg-buildpackage can be found in the package “cvs-buildpackage”. You’ll have to install a number of dependencies before this works. Just apt-get install packagename them as they come up.

# cd ..
# dpkg -i lighttpd_1.3.13-1_i386.deb

This will install lighttpd and start it.
Now you need to install and configure php:

# apt-get install php4-cgi
# vi /etc/lighttpd/lighttpd.conf

Look for the fastcgi.server section for php4 and change it so it looks like this:

fastcgi.server = ( ".php" =>
  ( "localhost" =>
    (
      "socket" => "/tmp/php-fastcgi.socket",
      "bin-path" => "/usr/bin/php4-cgi"
    )
  )
)

Download eaccelerator from their site and follow the instructions in the README. If you haven’t got phpize then install php4-dev.
Open up /etc/php4/cgi/php.ini and add the following at the top of the file:

  extension="eaccelerator.so"
  eaccelerator.shm_size="32"
  eaccelerator.cache_dir="/tmp/eaccelerator"
  eaccelerator.enable="1"
  eaccelerator.optimizer="1"
  eaccelerator.check_mtime="1"
  eaccelerator.debug="0"
  eaccelerator.filter=""
  eaccelerator.shm_max="0"
  eaccelerator.shm_ttl="1800"
  eaccelerator.shm_prune_period="1800"
  eaccelerator.shm_only="0"
  eaccelerator.compress="1"
  eaccelerator.compress_level="9"
  eaccelerator.content="shm_and_disk"

You’ll have to create the tmp directory yourself. Read the README file and config docs for instructions on using the web frontend to the accelerator.

I think that’s it, have I forgotten anything?

Categories
PHP

Smarty Sample Application: Guestbook

Ooh nice. Monte Ohrt wrote a guestbook as a demonstration of how to use Smarty to seperate presentation and code.
It’s well laid out and described in detail. If you’ve wondered what this Smarty thing is take a look at this and read through it a few times.
Later… PHP Guru has a guide to setting up an application’s structure which is worth a look!
My Top Two PHP Security Practices (via phpcomplete)
Synamic Typing (via PHP Everywhere)
lighttpd – lighttpd a secure, fast, compliant and very flexible web-server which has been optimized for high-performance environments. It has a very low memory footprint compared to other webservers and takes care of cpu-load. Its advanced feature-set (FastCGI, CGI, Auth, Output-Compression, URL-Rewriting and many more) make lighttpd the perfect webserver-software for every server that is suffering load problems. (via michel_v on IRC)