Feed aggregator

Community News: Packagist Latest Releases for 03.15.2014

PHPDeveloper.org - Sat, 15/03/2014 - 15:07
Recent releases from the Packagist:

Performance improvement for OCI_RETURN_LOBS in PHP OCI8 2.0.8

Planet-PHP - Sat, 15/03/2014 - 00:48

Reducing "round trips" to the database server is important for performance and ultimately for system scalability. A server round-trip is defined as the trip from PHP to the database server and back to PHP.

Reducing round trips makes everything more efficient: PHP is faster, there is less network overhead, the database doesn't have to do a context switch or do any processing for you. Applications have some control over round trips, for example by effectively using prefetching or by using an appropriate execute mode to minimize unneccessary rollbacks at the end of a script.

The bug filer of Bug 66875 noticed that PHP OCI8's implementation itself could reduce round trips if a particular LOB column meta data value was cached for the duration of a query instead of being re-requested for each row of the query result set.

So, now with OCI8 2.0.8, you should see a performance increase if you are doing multi-row queries involving LOB columns returned as OCI_RETURN_LOBS:

$s = oci_parse($c, "select mylobcol from mylobtab");
oci_execute($s);
while (($row = oci_fetch_array($s, OCI_ASSOC+OCI_RETURN_LOBS)) !== false) {
    echo $row['MYLOBCOL'], "\n";
}

The bug filer tested the patch and added his performance improvement benchmark results to the bug report. The benefit in your environment will vary greatly with the network setup, schema, and how many LOB columns are queried. Test it out and let me know how the new version helps you.

There is no immediate change for LOBs fetched with OCI-Lob::read() and OCI-Lob::load(). This would require a more complex patch than I want to apply at this time. Queries that don't use LOBs are not affected in any way by the patch.

OCI8 2.0 is included in the forthcoming PHP 5.6 code base. For PHP 5.2 to PHP 5.5 you can install it from PECL. PHP 5.5 RPMs with PHP OCI8 2.0.8 are available from oss.oracle.com.

Finally, if your LOB queries return multiple rows, you might also like this tip to reduce PHP memory usage.

Categories: Open Source, PHP Community

Community News: Three Devs and a Maybe Podcast

PHPDeveloper.org - Fri, 14/03/2014 - 19:51

The Three Devs and a Maybe podcast has been around since the end of last year and has posted some great episodes on a wide variety of topics, including several shows related to PHP. Some of their current shows include:

Check out the podcast and the past episodes and be sure to subscribe to their feed if you enjoy the show!

Link: http://threedevsandamaybe.com

Jonathan Hill: How much does it cost to be a web developer?

PHPDeveloper.org - Fri, 14/03/2014 - 18:17

Jonathan Hill has taken an interesting perspective in his recent post looking more at some of the average financial costs around being a web developer.

With Software Development topping 2014′s top jobs list, I thought I would share how much it cost me to become a web developer, and what my monthly expenses look like nowadays.

He breaks it down into a few different categories, listing an average price for each:

  • Initial (start-up) costs for hardware and software
  • Training costs
  • Recurring costs

Obviously, not all of the software and tools he lists are needed for every software developer, but it does give some perspective. Thankfully, he also links to some free alternatives to the tools he mentions that can reduce these costs as well.

Link: http://jonathonhill.net/2014-02-19/how-much-does-it-cost-to-be-a-web-developer/

Building a Twitter Hashtag Contest – Registering the App

Planet-PHP - Fri, 14/03/2014 - 18:00

This entry is part 1 of 2 in the series Building a Twitter Hashtag Contest with Twitter's APIIntroduction Social networking sites play a vital role in increasing the popularity of a website or application. The vast majority of web sites provide the ability to share their content on popular social media sites with the click […]

Continue reading %Building a Twitter Hashtag Contest – Registering the App%

Categories: Open Source, PHP Community

ServerGrove Blog: Symfony2 components overview: Templating

PHPDeveloper.org - Fri, 14/03/2014 - 17:11

The folks at ServerGrove have posted the latest in their series focusing in on various components of the Symfony2 framework. This time they look at the Templating component, useful for working with the output from the application, web or otherwise.

The Templating component provides an engine-agnostic infrastructure to load template files and render them using the input variables. Although the component provides methods for creating template systems, we are going to focus on how to integrate third-party template engines like Twig and Smarty, and how to use the right engine based on the templates file extension.

The post talks about typical PHP output (with escaping) and shows the difference between a call with htmlspecialchars and the use of the Template component to render a view. An example is also included showing the use of other template engines into the template object, plugged directly into the "render" method. The end of the post also briefly mentions an alternative template language, Plates, an option similar to Twig but uses native PHP rather than tags and placeholders.

Link: http://blog.servergrove.com/2014/03/11/symfony2-components-overview-templating/

SitePoint PHP Blog: Building a Simple Blog App with MongoDB and PHP

PHPDeveloper.org - Fri, 14/03/2014 - 16:19

On PHPMaster.com there's a recent tutorial posted showing you the creation of a simple blog application with MongoDB + PHP. It's a basic overview, so it's mostly about creates and reads, but it does help get things working.

If you want to create a blog using MongoDB and PHP, this article will teach you. [...] The reason I chose to build a blog application is because it is a basic CRUD application and it is very suitable for easing into PHP and MongoDB web development. We will build a plain user interface using Bootstrap with simple textboxes and buttons. A MongoDB database will store all the content.

He starts off by introducing MongoDB and some of the basic concepts around databases, collections and documents as they relate to it. He then moves into the installation process, getting and configuring a simple MongoDB instance running on localhost. He helps you get the MongoDB PECL driver installed for PHP and includes a bit of code to test the connection. Finally, he gets into the blog example itself and includes the full code to get it up and running.

Link: http://www.sitepoint.com/building-simple-blog-app-mongodb-php/

Community News: Packagist Latest Releases for 03.14.2014

PHPDeveloper.org - Fri, 14/03/2014 - 15:00
Recent releases from the Packagist:

Methods on primitive types in PHP

Planet-PHP - Fri, 14/03/2014 - 09:00

A few days ago Anthony Ferrara wrote down some thoughts on the future of PHP. I concur with most of his opinions, but not all of them. In this post I’ll focus on one particular aspect: Turning primitive types like strings or arrays into “pseudo-objects” by allowing to perform method calls on them.

Lets start off with a few examples of what this entails:

$str = "test foo bar";
$str->length();      // == strlen($str)        == 12
$str->indexOf("foo") // == strpos($str, "foo") == 5
$str->split(" ")     // == explode(" ", $str)  == ["test", "foo", "bar"]
$str->slice(4, 3)    // == substr($str, 4, 3)  == "foo"

$array = ["test", "foo", "bar"];
$array->length()       // == count($array)             == 3
$array->join(" ")      // == implode(" ", $array)      == "test foo bar"
$array->slice(1, 2)    // == array_slice($array, 1, 2) == ["foo", "bar"]
$array->flip()         // == array_flip($array)        == ["test" => 0, "foo" => 1, "bar" => 2]

Here $str is just a normal string and $array just a normal array - they aren’t objects. We just give them a bit of object-like behavior by allowing to call methods on them.

Note that this isn’t far off dreaming, but something that already exists right now. The scalar objects PHP extension allows you to define methods for the primitive PHP types.

The introduction of method-call support for primitive types comes with a number of advantages that I’ll outline in the following:

An opportunity for a cleaner API

The likely most common complaint you get to hear about PHP is the inconsistent and unclear naming of functions in the standard library, as well as the equally inconsistent and unclear order of parameters. Some typical examples:

// different naming conventions
strpos
str_replace

// totally unclear names
strcspn                  // STRing Complement SPaN
strpbrk                  // STRing Pointer BReaK

// inverted parameter order
strpos($haystack, $needle)
array_search($needle, $haystack)

While this issue is often overemphasized (we do have IDEs), it is hard to deny that the situation is rather suboptimal. It should also be noted that many functions exhibit problems that go beyond having a weird name. Often edge-case behaviors were not properly considered, thus creating the need to specially handle them in th

Truncated by Planet PHP, read more at the original (another 22929 bytes)

Categories: Open Source, PHP Community

PHPClasses.org: Lately in PHP Podcast #45 - "The Security of Future PHP Versions"

PHPDeveloper.org - Thu, 13/03/2014 - 20:17

The latest episode of the "Lately in PHP" podcast series has been released by PHPClasses.org today - Episode 45, "The Security of Future PHP Versions".

As the plans for the upcoming PHP 5.6 and PHP 6 versions are being finalized, some of the proposals are about improving the security of these future PHP versions. That has been one of the main topics discussed by Manuel Lemos and César Rodas on the episode 45 of the Lately in PHP podcast. They also have talked about several other types of proposals and ideas for PHP 6, as well a tutorial on How to Use a Webcam to take Pictures in PHP Application.

You can listen to this latest episode in a few ways - either through the in-page audio player, by downloading the mp3 or you can watch the live recording over on YouTube.

Link: http://www.phpclasses.org/blog/post/229-The-Security-of-Future-PHP-Versions--Lately-in-PHP-podcast-episode-45.html

Ulf Wendel: The performance penalty of the early MySQL Fabric support for PHP

PHPDeveloper.org - Thu, 13/03/2014 - 19:16

In his latest post Ulf Wendel looks at the performance issues around the recently introduced MySQL Fabric support included in the mysqlnd extension.

PECL/mysqlnd_ms 1.6 is currently being modified to support sharding and fully automatic server and client failover when using MySQL Fabric (slides) to manage a farm of MySQL servers. PECL/mysqlnd_ms is a mostly transparent load balancer that works with all PHP MySQL APIs (PDO_MySQL, mysqli, ...). The idea is, that if, for example, a MySQL server fails, the plugin talks to MySQL Fabric to learn about alternative servers that Fabric has provisioned automatically. This "talks to" gives implies a performance penalty for applications.

He takes a look at what's happening "behind the scenes" when it comes to using the Fabric functionality and sharding (based on the use of mysqlnd_ms_select_shard). He traces through the execution path and how much slower then end result is. He includes some results from the connection debugging and the number of queries a single request makes.

Link: http://blog.ulf-wendel.de/2014/the-performance-penalty-of-the-early-mysql-fabric-support-for-php/

Community News: phpBB Participates in the Google Summer of Code

PHPDeveloper.org - Thu, 13/03/2014 - 18:54

As is mentioned in this new post to the phpBB forums, the project is participating in the Google Summer of Code project this year. phpBB is one of the longest running, widely used open source PHP forums software.

With two years of participation under our belt, I am glad to announce that phpBB is once again taking part in the Google Summer of Code (GSoC) program this year. Google's Summer of Code program encourages students to get involved in free and open source software (F/OSS) by pairing them up with experienced mentors in popular F/OSS projects.

If you're interested in working on the phpBB project this year, check out their Ideas page for some examples of things they're wanting to work on. You'll need to be familiar with the git version control system to do the work and will need to apply to be considered for this year's event.

Link: https://www.phpbb.com/community/viewtopic.php?f=14&t=2231996

Anthony Ferrara: Why I Don't Recommend Scrypt

PHPDeveloper.org - Thu, 13/03/2014 - 17:11

Anthony Ferrara has a new post today looking at password hashing and a type of hashing that's beginning to get more attention in the PHP community - scrypt. However, he doesn't recommend it for production password storage and shares his reasoning why.

Scrypt was not designed for password storage. It was designed as a key derivation function for generating keys from weak material (namely passwords). The prime type of attack that scrypt is designed to defeat is ASIC based attackers. It is not designed to try to favor CPU over GPU (and thereby defeat GPU based attacks). It is this fact that we can leverage to gain an advantage when used as a password hashing mechanism.

He covers some of the basic design decisions that were made when scrypt was created. He also points out that none of the results of these decisions are strictly fatal, they just make it a bit weaker than something like bcrypt for password storage. He goes through the basic inputs scrypt requires and includes a quick snippet of code (not PHP, but easy to understand) showing its use. He talks about its "chain of 4 operations" and gets into what he sees as limitations: loop unrolling and the tune-able reduced memory usages. He finishes off the post mentioning that scrypt is still secure, but despite this he doesn't recommend it for password storage specifically.

Link: http://blog.ircmaxell.com/2014/03/why-i-dont-recommend-scrypt.html

SensioLabs Insight Blog: Jenkins integration

PHPDeveloper.org - Thu, 13/03/2014 - 16:06

The latest post to the SensioLabs Insight blog today shows you how you can integrate the service with Jenkins as a part of your pre-existing continuous integration workflow.

One of the main features of SensioLabsInsight service is that it integrates smoothly into your existing workflow and technical infrastructure. We know that most companies use Jenkins as their continuous integration server and for that reason, SensioLabsInsight provides out-of-the-box Jenkins integration.

The integration uses the Insight API to perform the checks and return a report of the results. They step you through the process to get the connection set up (using the API client) and send the request for processing. The result is returned in PMD format, something Jenkins can easily parse and integrate into the pass/fail of the job. You can also get the details of the issues including error message, file location and the priority of the issue.

Link: http://blog.insight.sensiolabs.com/2014/02/12/jenkins-integration.html

Community News: Packagist Latest Releases for 03.13.2014

PHPDeveloper.org - Thu, 13/03/2014 - 15:01
Recent releases from the Packagist:

The performance penalty of the early MySQL Fabric support for PHP

Planet-PHP - Thu, 13/03/2014 - 00:42

PECL/mysqlnd_ms 1.6 is currently being modified to support sharding and fully automatic server and client failover when using MySQL Fabric (slides) to manage a farm of MySQL servers. PECL/mysqlnd_ms is a mostly transparent load balancer that works with all PHP MySQL APIs (PDO_MySQL, mysqli, …). The idea is, that if, for example, a MySQL server fails, the plugin talks to MySQL Fabric to learn about alternative servers that Fabric has provisioned automatically. This “talks to” gives implies a performance penalty for applications. One worth looking at, to understand it. One worth looking at, to have a success story once the early implementation is gone and replaced with a proper one ;-) .

Behind the scenes…

How exactly a “Fabric aware” driver or application talks to Fabric is implementation dependent. Figures given for PHP must not be used to extrapolate behaviour of Connector/J or Connector/Python. Only remarks about Fabric itself apply to all.

Let’s assume you want to use MySQL Fabric and PHP for sharding. Fabric takes care of all the server side stuff: splitting, merging, monitoring shards and so forth. The PHP application ensures that queries end up on the appropriate shards by hinting the driver which shard to use. In the PHP case, the “driver” is the PECL/mysqlnd_ms plugin for mysqlnd. The plugin exports a function mysqlnd_ms_select_shard() for hinting it.

$mysqli = new mysqli("myapp", "user", "password", "database");
mysqlnd_ms_select_shard($mysqli, "mydb.mytable", "key");
$mysql->query("INSERT INTO mytable(col1) VALUES ('abc')");

This tiny snippet triggers a huge machinerie: from you application it goes to the plugin. Then, the plugin calls Fabric via XML RPC over HTTP and waits for a reply. Once Fabric has replied, the plugin makes the connection handle point to the shard.

Client   Fabric mysqlnd_ms_select_shard(link, table, key)   PECL/mysqlnd_ms *.c XML RPC over HTTP: sharding.lookup_server(table, key, LOCAL) ->     HTTP worker thread   Executor   <- XML reply HTTP worker thread PECL/mysqlnd_ms: make $link use shard mysqli_query($link, …) The hotspots

Switching a connection from one server to another takes some effort. The current implementation will simply replace an plugin internal list of servers. This is a very fast operation. No new MySQL connection is opened yet. By default, lazy connections are used and the connect to the shard is delayed until the application issues a query. Let’s consider this a cheap step, that can be marked green below.

Client   Fabric mysqlnd_ms_select_shard(link, table, key)   PECL/mysqlnd_ms *.c XML RPC over HTTP: sharding.lookup_server(table, key, LOCAL) ->     HTTP worker thread …

Asking Fabric for a set of one master any number of additional slaves that make a shard is expensive. Upon every call to mysqlnd_ms_select_shard(), PECL/mysqlnd_ms opens a HTTP connection to Fabric to make an XML remote procedure call. Future version of the mysql plugin will do less calls, but that’s no

Truncated by Planet PHP, read more at the original (another 11123 bytes)

Categories: Open Source, PHP Community

/Dev/Hell Podcast: Episode 41: Let Me Wet My Beak

PHPDeveloper.org - Wed, 12/03/2014 - 20:14

The /Dev/Hell podcast, hosted by Chris Hartjes and Ed Finkler, has posted its latest episode - Episode 41: Let Me Wet My Beak. In this new episode they're joined by guest David Rogers.

This week we're joined by David Rogers, aka @al_the_x, to hear how he's teaching PHP in college courses for brand-new programers. We also talk about what possessed Ed to develop his own unit testing framework.

You can check out this episode either through the in-page player or by downloading the mp3 of the show. Also, be sure to subscribe to their feed if you like what you hear.

Link: http://devhell.info/post/2014-03-10/let-me-wet-my-beak/

Lorna Mitchell: Using Composer Without GitIgnoring Vendor/

PHPDeveloper.org - Wed, 12/03/2014 - 19:45

In her latest post Lorna Mitchell looks at a method, when using Composer and git, to fix an issue around subdirectories that are git repositories and git thinking they should be submodules instead.

Recent additions to the joind.in API have introduced some new dependencies so we decided we'd start using Composer to manage these - but we don't want to run composer unsupervised. I'm sure this will bring the rain of "just run composer install, it's probably mostly almost safe" criticism, but actually it's quite tricky to run Composer without excluding vendor/ from source control so I thought I'd share how we did it so that anyone who wants to do so can learn from my experience!

She starts by describing the usual use of Composer - making the "composer.json", running the install and see the "vendor" directory being added. When she tried to check in the dependencies, git gave her an error about wanting them to be submodules. Instead, she figured out a way to add a line to the .gitignore to have it disregard the "vendor/.git" directory, making it work as expected.

Link: http://www.lornajane.net/posts/2014/using-composer-without-gitignoring
Syndicate content