Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

MongoDB Blog:
Call for Feedback: The New PHP and HHVM Drivers
Mar 12, 2015 @ 16:33:23

The MongoDB blog has a new post asking for feedback on what the user community thinks of their approach to supporting MongoDB functionality in PHP 5.x, HHVM and even out to PHP7.

Since the PHP driver first appeared on the scene, MongoDB has gone through many changes. [...] Beyond MongoDB's features, our ecosystem has also changed. [...] During the spring of 2014, we worked with a team of students from Facebook's Open Academy program to prototype an HHVM driver modeled after the 1.x API.

[...] Although the final result was not feature complete, the project was a valuable learning experience. The C driver proved quite up to the task, and HNI, which allows an HHVM extension to be written with a combination of PHP and C++, highlighted critical areas of the driver for which we'd want to use C. This all leads up to the question of how best to support PHP 5.x, HHVM, and PHP 7.0 with our next-generation driver.

They've shared the overview of the new driver structure including three layers: the system level functionality, the extensions themselves and a MongoDB userland library. They walk through the thinking on each of the pieces of the puzzle and how they all couple together to make for a more robust, flexible system that's also easy to use.

tagged: mongodb drivers extension mongo userland library architecture opinion feedback

Link: http://www.mongodb.com/blog/post/call-feedback-new-php-and-hhvm-drivers

Derick Rethans:
Understanding Valgrind errors (1)
Feb 04, 2014 @ 17:03:02

Using the Valgrind tool can give you a good window into the inner workings of your PHP script (at a very low level) but the results it gives can be a bit confusing to interpret. In his latest post Derick Rethans uses the memcheck tool that comes as a part of Valgrind to monitor memory usage and interprets some of the results.

Memcheck is really valuable for C and C++ developers and something you should learn, especially when you write PHP extensions. Memcheck's error messages can sometimes be difficult to understand, so with this (infrequent series), I hope to shed some light on it. Let's have a look at the following Valgrind error output, which I encountered while debugging issue PHP-963 of the MongoDB driver for PHP.

He walks though the output and how to spot the actual error - a reference to a null pointer in the C code. He tracks it back through the code and finds the spot where it references the wrong memory segment in the Mongo PHP extension code.

In short, an error where Address 0x38 is not stack'd, malloc'd or (recently) free'd has a low address in the message often means a NULL-pointer dereference.
tagged: valgrind error memcheck mongo extension

Link: http://derickrethans.nl/valgrind-null.html

Derick Rethans:
Mongo is dead, long live MongoClient
Nov 28, 2012 @ 15:13:51

In this recent post to his site Derick Rethans mentions the shiny new "MongoClient" class that the latest release of the Mongo PHP drivers provides.

This afternoon we published version 1.3.0 of the MongoDB PHP driver. Besides a number of bug fixes since RC2 and RC3, this new release also includes a new MongoClient class. This new MongoClient class serves as a replacement for the Mongo class. The old Mongo class is now deprecated and will be removed in a future release, although we are keeping it in place for now because of backwards compatibility reasons. We have already removed it mostly from the documentation, and are working to update all our other material as well.

The main change that comes with the MongoClient class is that it now has acknowledged writes on by default (a "safe mode"). This option determines wether or not the client waits for a confirmation from the server when a write has happened. He includes a bit of code showing how to: turn it off, keep it on or using replica set acknowledged writes. You can also set it on a per-query basis.

tagged: mongo class driver release mongoclient class confirm write

Link:


Trending Topics: