By request, a quick post on using PHP references in extensions. To start, here’s an example of references in PHP we’ll be translating into C: This will print: x is 1 called not_by_ref(1) x is 1 called by_ref(1) x is 3 If you want your C extension’s function to officially have a signature with ampersandsContinue reading “More PHP Internals: References”
Category Archives: PHP
PHP Extensions Made Eldrich: Classes
This is the final section of a 4-part series on writing PHP extensions. Setting Up PHP – compiling PHP for extension development Hello, world! – your first extension Working with the API – the PHP C API Classes – creating PHP objects in C Objects branch: oop This section will cover creating objects. Objects areContinue reading “PHP Extensions Made Eldrich: Classes”
PHP Extensions Made Eldrich: PHP Variables
This is section 3 of a 4-part introduction to PHP extensions: Setting Up PHP – compiling PHP for extension development Hello, world! – your first extension Working with the API – the PHP C API Classes – creating PHP objects in C This section is, unfortunately, longer than all of the other sections combined. TheContinue reading “PHP Extensions Made Eldrich: PHP Variables”
PHP Extensions Made Eldrich: Hello, World!
This is part 2 of a 4-part tutorial on writing PHP extensions: Setting Up PHP – compiling PHP for extension development Hello, world! – your first extension Working with the API – the PHP C API Classes – creating PHP objects in C First we need to think of a name for our extension. I’veContinue reading “PHP Extensions Made Eldrich: Hello, World!”
PHP Extensions Made Eldrich: Installing PHP
A PHP extension allows you to connect almost any C/C++ code you want to PHP. This is a 4-part tutorial on how to write an extension: Setting Up PHP – compiling PHP for extension development Hello, world! – your first extension Working with the API – the PHP C API Classes – creating PHP objectsContinue reading “PHP Extensions Made Eldrich: Installing PHP”
Scaling, scaling everywhere
Interested in learning more about scaling MongoDB? Pick up September’s issue of PHP|Architect magazine, the database issue! I wrote an article on scaling your MongoDB database: how to choose good indexes, help handle load using replication, and set up sharding correctly (it’s not PHP-specific). If you prefer multimedia, I also did an O’Reilly webcast onContinue reading “Scaling, scaling everywhere”
MongoDB PHP Driver 1.0.3 Release
Version 1.0.3 was released today. Everyone should upgrade because there were some weird bugs in 1.0.2 due to a half-complete feature that was added in 1.0.2 and has since been removed. Unfortunately, because I’ve had to bump up the release date, the big feature that was scheduled for 1.0.3, asynchronous queries, has been pushed toContinue reading “MongoDB PHP Driver 1.0.3 Release”
Upcoming Talks
Want to learn more about MongoDB? Here’s the places I’ll be speaking in the next month or so: January 13th – DC PHP Meeting (http://www.dcphp.net/) January 19th – New York Perl Mongers Seminar (http://tech.groups.yahoo.com/group/perlsemny/) January 25th – Long Island PHP User Group (http://www.liphp.org/) February 7th – FOSDEM – Free and Open Source Developers European MeetupContinue reading “Upcoming Talks”
Replacing $ in the MongoDB PHP Driver
I’ve just added a feature to the Mongo PHP driver (and I plan to add it to the Perl driver soon) to use a character other than $ for special ops. In Mongo, there are tons of interesting things you can do by using $-prefixed strings: // run a server-side function as part of aContinue reading “Replacing $ in the MongoDB PHP Driver”
PHP Extension Wiki
I started a wiki on this site (http://www.kchodorow.com/php) to write down all the stuff I learn about writiing PHP extensions. If anyone else has experience with them, feel free to add or edit articles. Some basics: a PHP extension is written in C. In fact, PHP itself is written in C, so there’s a lotContinue reading “PHP Extension Wiki”