BDKR has a rant here about OO in PHP. I agree with some of what he says. There’s lots of bad code and design out there (I can’t promise to be perfect either!) but that permeates functional and procedural programming too.
I happen to like working with objects and structuring code in that way. It was a hell of a thing to get used to in college though, Before that I had done a lot of work coding in ASM on the C64. Actually having structures to work with was a real boon!
On a related topic, John mentioned a ObjectView, a PDF magazine about OO for developers. May take a look at it later.
Author Archives: Donncha
Thanks Dave
PHP 4.3.2 is out
A new release of PHP is out today. It looks like a required update with a HUGE amount of other bug fixes!
Update! I upgraded 2 servers. One with Apache 1.3.27, php_accelerator went fine, but the other with mod_ssl, mod_gzip and php_accelerator refused to work. Every request resulted in a seg fault. I compiled PHP with mm support for mod_ssl (is that necessary?) but haven’t got time to track down where the crash occurs. (I tried disabling both mod_gzip and php_accelerator with no luck)
I’ll give it another go later.
I just want masquerading! Help!
This is invaluable when your gateway server crashes and it’s been a *long* time since it was last rebooted. It always happens while you’re sick too..
b2 updates – referer spamming, b2++ and WordPress
First of all the trivial stuff. I just noticed that my referer log was spammed by some domain resellers. The script I based my referer code on already had “checking” in there to make sure the referer actually listed your url on it, but I didn’t enable it. That’ll be enabled and added to b2options shortly. I also added a “delete” function to b2referers so you can delete referer records to get rid of spammers.
I just noticed that Google, Ask Jeeves and other search engines have visited in the past few days. I should really ignore those hits in the referer script.
This morning I received an email from Matthew Mullenweg asking me to join the WordPress effort. It took me all of 5 seconds to agree that b2 would be best served by a merger of b2++ and WordPress.
I’m off to Chicago on Sunday, life’s hectic here as I tie up loose ends. It’ll probably take a few weeks before there’s anything useable from this merger, but I’m excited at the future possibilities of b2!
Did you download the Matrix 2?
I find this BBC article laughable! I spent over a week dodging Matrix 2 spoilers until I saw it last night! Even if the downloaded movie is of a higher quality than the usual movie rips I’d still rather see the movie in the cinema! This Slashdot discussion has more opinions and rants..
ATi cheated too?
Looks like Nvidia aren’t the only ones who cheated in benchmarks! Although the Register dubbed it, “optimised code”.
They conclude, “Or toss a coin – just as valid a basis for judgement as benchmarks these days” when buying a new graphics card.
Install Sendmail – 6.0
It’s been a while, but I released a new version of Install Sendmail today. This version now works on Red Hat 9, or other modern Linux/Unix systems with Sendmail 8.12.x (Thanks to Brent D Miller!)
I also added a Polish translation by Michal Gawron, thanks!
PHP: Process Control Functions
I had quite forgotten that PHP can fork a process just like in C! This might be a useful thing to know for doing background tasks, but to be honest the extra complexity required will probably put me off doing it. That’s where this Thread class comes in handy..
<?php
include ("threadClass.php");class testThread extends Thread {
function testThread($name) {
$this->Thread($name); // calls the parent constructor and assign its name
}function run() {
while(true) {
sleep(1);
print time() ."-" . $this->getName() . " said ok...\n"; // every second we're going to print this line...
}
}
}
// Main program. Bring up two instances of the same class (testThread).
// They runs concurrently. It's a multi-thread app with a few lines of code!!!$test1 = new testThread ("Thread-1");
$test2 = new testThread ("Thread-2");
$test1->start();
$test2->start();print "This is the main process. Press [CTRL-CANC] to terminate.\n";
while(true) {sleep(1);}?>
Busy
You can tell I’m busy. No posts today so far. Installing Apache, MySQL, PHP on a new machine, and fiddling with firewalls.
Anyone good at iptables stuff? How do I let MSN Messenger through? The following would work fine if not for Messenger!
# /etc/sysconfig/iptables
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:RH-Lokkit-0-50-INPUT - [0:0]
-A INPUT -j RH-Lokkit-0-50-INPUT
-A FORWARD -j RH-Lokkit-0-50-INPUT# lan
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp -s 192.168.1.0/255.255.255.0 -d 0/0 -j ACCEPT# ssh
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 22 --syn -j ACCEPT# smtp
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 25 --syn -j ACCEPT# dns
-A RH-Lokkit-0-50-INPUT -p udp -m udp -s dns1_server1 --sport 53 -d 0/0 -j ACCEPT
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp -s dns_server2 --sport 53 -d 0/0 -j ACCEPT# localhost
-A RH-Lokkit-0-50-INPUT -i lo -j ACCEPT# reject everything else
-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --syn -j REJECT
-A RH-Lokkit-0-50-INPUT -p udp -m udp -j REJECT
COMMIT
I found reAim which is a compact transparent proxy designed to be run on or behind a Linux IPTables based firewall.
Trying to proxy through Squid didn’t work either, I got the following error:
TCP_DENIED/403 1020 CONNECT messenger.hotmail.com:1863 – NONE/- –
That’s annoying.
