PHP

PHP + LDAP + SSL (LDAPS) authentication in Windows running Apache

I tried to set up LDAPS (LDAP + SSL) based authentication in a Drupal site, but it didn't want to work. Here's how I managed to solve the issue.

Making PHP session expire (in Drupal and in general)

(...) Modern Linux distro's, say Ubuntu (8.10) comes with a default PHP configuration of session.gc_probability = 0. This means that in general, session GC will never run(!). There is a unix cron job that runs every half hour and checks for old sessions to delete (see more at /etc/cron.d/php5) but this is done only if you're using the standard "files" as your session handler (check out the directive of session.save_handler on your machine to learn what php default sessions handler is but make sure to check that your application doesn't overwrite this), so for Drupal users using plain Debian/Ubuntu, stock LAMP packages and stock Drupal applications, this means that the PHP garbage collection, despite your best intentions, will also never run. (...)

How to install the OCI8 Oracle extension for PHP5 in Debian Lenny

The linked page describes it very well. Just a quick note for myself in case the original post disappears:

How To Set Up Apache2 With mod_fcgid And PHP5 On Debian Lenny

A good article, I used to set up FCGI the same way. I had to find all the necessary info myself, when I first tried to use FCGI with a multi-site setup (separate PHP config, etc. for each site), but I'm glad that meanwhile somebody took the time to write it down. Smiling

mysql_connect and ‘No such file or directory’

This blog post helped me a lot ... probably it'd have taken a few hours to figure out why mysql_connect() dies with a "No such file or directory" error. I had a feeling (while I was reading the readme in the Mac installer of the currently available MySQL server, which got obviously outdated years ago) that there're problems to be expected with the MySQL install. Sad

Easiest way to activate PHP and MySQL on Mac OS 10.6 (Snow Leopard)?

A straight to the point guide on how to configure the built-in Apache (where are the config and command files), etc. As it turns out, it already ships with PHP support and it was already running for some reason. Shocked Never mind. The first thing I did after installing the OS was to set up a firewall (ipfw in this case), so having an Apache on the inside did really not matter much (probably took a few MBs of the memory). But now I need it anyway, so I'm not very upset that I didn't have to install it from scratch. Smiling

Building packages for PECL extensions in Debian

The key is the dh-make-php package. It contains the dh-make-pecl command, which can download and prepare PECL extensions so you can easily build a Debian package from them.

Regular Expression Matching Can Be Simple And Fast (but is slow in Java, Perl, PHP, Python, Ruby, etc)

"This is a tale of two approaches to regular expression matching. One of them is in widespread use in the standard interpreters for many languages, including Perl. The other is used only in a few places, notably most implementations of awk and grep. The two approaches have wildly different performance characteristics ..."
A very interesting article on regular expression matching algorithms.

How to block Senegal IP addresses

My experience shows that a lot of con emails come from Senegal. If you maintain a forum or some kind of social network website, you might want to consider to block users from Senegal IPs. Here's a PHP code snippet with the current IP ranges assgined to Senegal ISPs, etc.

str_replace vs. preg_replace

Today I faced the problem of removing all occurances of a fixed number of characters from a string. I was curious how str_replace performed against preg_replace in this case.

Syndicate content