89 items tagged “php”
2007
OpenID (and TypeKey) using native OpenSSL functions in PHP. Wez Furlong shows how a small patch to PHP’s OpenSSL support makes it a whole lot easier to perform the cryptography behind OpenID (at the moment you need to use the bc or gmp modules).
2006
phpMyID. A simple, stand-alone OpenID server in a single PHP script with no dependencies. Makes managing your own identity trivial.
Yahoo! bookmarks uses symfony. Top reason for the decision was the excellent documentation.
PHP: JSON Functions. Now bundled in PHP 5. A great way to move data from PHP to some other language.
PHP: __halt_compiler(). This is nuts.
2005
Testing a new version of IXR
Almost two years to the day since the last release, I’ve put together a new version of IXR, my PHP XML-RPC library. I haven’t published it on the site just yet as I want to make sure any bugs are ironed out first, but you can grab a copy here:
[... 177 words]2004
Updated FormProcessor code released. Now available through Subversion.
Zend PHP 5 Goodies
Zend have quietly released a veritable treasure trove of PHP 5 tutorials via their PHP5 InfoCenter:
[... 212 words]PHP 5 Release Candidate 1
I haven’t blogged much about PHP in a while because I’ve been up to my nose in mod_python and loving every minute of it. This news is just too important to miss: PHP 5 Release Candidate 1 has been released, bringing the first production-ready release tantilisingly close. While I doubt PHP 5 will tempt me back it’s definitely an exciting upgrade—my biggest complaint with PHP 4 is the brain-dead object model which defaults to copying whole objects rather than passing references, and this is one of the many things addressed by PHP 5. The new libxml2 powered XML features sound really powerful, and SQLite as an on-board database should be ideal for knocking out small stand-alone applications without needing to set up a mySQL database for them.
[... 173 words]2003
An apology
It turns out that the Javascript on PHP.net mentioned previously was not deliberately obfuscated to protect the code from prying eyes; it was merely compressed to reduce the size of the script. See this comment for further details. I’d like to apologise to the maintainers of PHP.net for jumping the gun on this issue. Incidentally, the unobfuscated code is now available in CVS.
The good and the ugly
PHP.net has a new feature on their search page—a really nice implementation of an auto complete text widget in Javascript. Even better, the search page is valid XHTML 1.0 Strict and uses CSS for the layout. Let’s hope this is an indication of things to the come for the rest of the site, which still mostly consists of tag soup.
[... 368 words]Easy installers for PHP scripts
I tried out FUDforum last night, after Rasmus Lerdorf recommended it in a comment on Jeremy Zawodny’s blog. Feature wise, it’s pretty impressive but still doesn’t quite do it for me—I want something that’s trivial to integrate with an existing authentication system and outputs valid HTML (or XHTML) out of the box. Rasmus says it’s the only board he’s seen that doesn’t have obvious security holes though so it’s probably worth checking out if you need to set up a forum of that kind.
[... 275 words]The difference between POST and GET
How important is the ability to tell the difference between data sent by POST and data sent by GET (i.e in the query string) when developing web applications? Some web frameworks (such as PHP) provide separate mechanisms for accessing POST and GET data. Others (such as Python’s cgi module) provide a single interface to form information that doesn’t distinguish between the two. I already have a strong opinion on this but I’m going to leave it open for discussion here for a bit before weighing in.
PHP’s date() function in Python
In switching from PHP to Python I’m discovering an increasing number of PHP functions that I’ve learnt to rely on but have no direct equivalent in the Python standard library. Often Python simply provides a different way of approaching the problem, but old habits die hard and I’ve been replicating some of PHP’s functionality in Python for my own personal use.
[... 422 words]PHP Library Tips
Kellan Elliott-McCrea (author of the popular Magpie RSS parser): A Few Tips for Writing Useful Libraries in PHP. Kellan makes the interesting observation that PHP encourages a culture in which most development occurs in the context of either full applications or C extensions, with few people devoting themselves to releasing libraries.
Ludicrously simple templates with Python
A long, long time ago I wrote my first ever PHP templating system. It was pretty simple; it consisted of a function that took two arguments: the name of a template file, and an associative array of replacements to make on that file.
[... 251 words]PHP philosophy, and bundling SQLite
Here’s a great quote from Rasmus Lerdorf (the creator of PHP) for people who have become disheartened with PHP’s lack of elegance when compared to other languages such as Python:
[... 232 words]Supporting Conditional GET in PHP
This site’s RSS feeds now support Conditional GET. Since the feeds are dynamically generated on every request, adding support took a bit of hacking around with PHP. Here’s the function I came up with (based on the excellent description provided by Charles Miller in the article linked above):
[... 398 words]Verbose Regular Expressions
Ned Batchelder describes Verbose Python regular expressions. This is one of the things I’ve known about (as in known that they exist) for ages but have never got around to using. I’ve been working with some pretty heavy regular expressions recently that could really do with the clarity of being defined in verbose format with comments.
[... 96 words]Hashing client-side data
Via Scott, a clever PHP technique for ensuring data sent to the browser as a cookie or hidden form variable isn’t tampered with by the user:
[... 248 words]2002
Funky caching explained
I didn’t take much notice of “funky caching” while reading through Rasmus Lerdorf’s PHP tips and tricks presentation—I saw that it was talking about using custom 404 pages to serve up dynamic content depending on the URL and wrote it off as a hack that, while useful, was fundamentally flawed in that it would add an error log entry whenever a page was served.
[... 208 words]PHP tips and tricks from Rasmus
Rasmus Lerdorf has published a PHP Tips and Tricks PDF based on a presentation given at the recent PHPCon2002. The file is a veritable goldmine of useful information, covering topics including optimisation, sessions, security, dynamic image/flash/PDF generation and using Squid and MySQL replication to increase the performance of a high traffic site. Spotted on PHPDeveloper.org.
Girlfriend as a case study
I’ve been helping my girlfriend recreate her site using CSS and structural markup. She’s new to web design and has been taking to CSS like a duck to water—as a veteran of Microsoft Word globally defined styles come to her naturally and she took very little time to cotton on to the importance of seperating presentation from content. I’ve shown her tables as well but she isn’t really interested as she sees CSS as a much better solution for general presentation. I’m hoping to help run an HTML/XHTML/CSS training course at the University early next year with a heavy emphasis on structural markup, standards compliance and accessibility so it’s great to have a guinea pig to play with :)
[... 201 words]Zend re-design... terrible!
Zend (the commercial company behind the PHP scripting language) have launched a redesign of Zend.com. My verdict on the new design ... terrible.
[... 161 words]PHP generated PDFs
R&OS PDF PHP classes (via tidak ada). This is the most useful PHP library I’ve seen in a long time. It allows dynamic generation of PDF files without needing any additional modules installed on the server (although GD is required if you want to add images to your PDFs). It is extremely easy to use and has an impressive set of features, including PDF drawing tools, built in page number support and excellent documentation. On the topic of PDFs, Yes You Can advocates their use for presentations and touches on a method of generating them using Python.
Magic quotes solution
Pink Goblin (otherwise known as HarryF) explains why magic quotes are evil. This is an issue that every PHP developer should be aware of, as it can cause all kinds of problems in your scripts if you ignore it. He suggests using a custom myAddSlashes()
function which only calls addslashes() if magic quotes are turned off. I have an alternative solution—chose your preferred setting (quotes on or off) and apply it at run time to all incoming data in one go. My code for doing this is available here. By a bizzare coincidence I wrote the script this morning, then spotted a link to the Pink Goblin article on tidak ada literally five minutes after finishing it.
Blogchat rocks
I spent a while today over at Brent Ashley’s blog chatting away on BlogChat. BlogChat is Brent’s impressive DHTML chat system (backend in PHP, front end via JSRS) which allows anyone visiting his blog to talk to him (and other visitors) in real time, provided he is online to host the session. During the afternoon I got to talk to people from all over the world, all with similar interests because they all had the same taste in blogs. I am hoping to install a version of Brent’s system on this site in the not-too-distant future.
Rasmus Lerdorf’s blog
Rasmus Lerdorf (the creator of PHP) has a blog. His latest entry discusses Palladium, and asks if it will actually help build up the alternative market of non wintel users.