News aggregator

P'unk Avenue Blog: Faster, PHP! Kill! Kill!

PHPDeveloper.org - 6 hours 14 min ago

On the P'unk Avenue blog there's a recent post from Tom Boutell looking at optimizing PHP applications and how you can cope with the possibility of "Serious Traffic" that might come your way.

PHP is easy...as programming languages go, that is. You can build sites in a real hurry. [...] Still, sooner or later success catches up with you and you want your site to cope with Serious Traffic...or cope with moderate traffic on a cheap virtual machine...or at the very least, not be dog-slow with just a handful of users on the system.

He mentions things that can slow down the application (like timeouts on web server connections or not optimizing the site with a "thin" server for non-PHP requests). He mentions the alternative PHP cache (APC) as one possible way to help, some tips on making your Apache server more efficient and pushing those lighter requests off to a smaller, built-for-speed server using FastCGI.

Categories: Resources

Easier templating for Midgard 8.09

Planet PHP - 7 hours 18 min ago

For a while now there has been discussion about making template editing easier with Midgard CMS. In the Ragnaroek series we have a very comprehensive template system where all output from the system can be overridden. While the possibilities have not always been easy to discover, things should be better in the next Ragnaroek LTS release.

To access the template system just click Folder > Edit layout template in the Midgard toolbar:

This will take you into Asgard, the Midgard administration interface. There you'll be shown what elements are used by the components running on your site:

Clicking on an element name will let you create it. Then you'll be shown the default contents of that element to make overriding them easier. The language used in the templates is obviously PHP:

When you save your element it will replace the component's default output in the folders using that particular style. You can also do nice things like including contents from another page using Dynamic Loading.

What about file attachments?

Asgard also allows you to add files (images, CSS, javascript, whatever) to your template. To do this click the Attachments button when you're in the style. There you'll be able to manage existing file attachments and to add new ones:

If you're dealing with a text-based file (CSS, javascript, XML, ...) Asgard will also allow you to edit it directly on the web:

...and finally when you're done with your file and want to use it in some of your templates, the URL is available easily from the interface:

Categories: News

Jack Diederich's Blog: Comparing the Ruby/PHP/Python C Interpreters

PHPDeveloper.org - 7 hours 48 min ago

Recently on his blog Jack Diederich took a look at three different interpreters for Ruby, PHP and Python to see how they were implemented as compared to the language they're used in.

The other day I went poking around the Ruby and PHP interpreters (the current stable versions). I hadn't looked inside PHP since the 4.x series and Ruby I had never checked out. Like CPython the internals of both PHP and Ruby look something like their resulting language, but in C. For each interpreter I just compiled it and looked at how core types and extension types were implemented.

For PHP, he went with the PHP 5.2.13 release and talks about the compile process (a bit spammy), running the unit tests that come included and how the interpreter handles data types, core types and objects.

Categories: Resources

Kovshenin.com: The Web Development Cycle Explained

PHPDeveloper.org - 7 hours 54 min ago

On Kovshenin.com there's a recent post looking at the whole development lifecycle of web-based applications, breaking it out into the three main steps - development, testing and production (splitting out some of these into other, smaller groupings).

Since January this year I've been working on a few projects with a team of over 5 people and high-demanding standards. This raised the problem of project managing and a completely different view of the web development cycle. In this article I'd like to outline the major steps of the software development cycle and how they could be applied to the web development business.

Along with the main three categories (dev, test and production) he also gets a bit more fine grained with things like:

  • Development: Pre-alpha Stage
  • Development: Beta Stage
  • Testing: Release Candidate
  • Production: General Availability
Categories: Resources

Joomla Community Site: Creating a Joomla Template From Scratch

PHPDeveloper.org - 9 hours 40 min ago

On the Joomla community site there's a recent post made of a video from the Joomla Day conference in Australia about creating a Joomla template from scratch. The presenter is Norm Douglas.

Norm Douglas recently presented about how to create a Joomla template from scratch at the Joomla Day in Melbourne, Australia, on 13 February 2010. This is a very informative 77 minute presentation and also covers using the Firebug Firefox addon, code editors and much more.

He covers some simple tools you get you started, the basics of HTML to create a sample layout and looks at CSS definitions that can make the layout look a bit better. Firebug (the plugin for Firefox) helps make locating the different parts of the page easier with a highlighting feature.

Categories: Resources

PHPBuilder.com: Ajax and PHP: The Simple Way

PHPDeveloper.org - 10 hours 2 min ago

Marc Plotz has written up a new tutorial for PHPBuilder.com introducing a simple way to get started combining PHP and Ajax with a "Google Suggest" type of example.

When you use Ajax with PHP, PHP does the calculations that it needs to do on the server and sends the result back to the page. You then use JavaScript to display these results in a predefined place. The demo application you will learn how to build in this article is a very simple Suggestion box, just like the one that Google made famous and thus ushered in the Ajax era.

The example (you can download it here) creates a basic form text field and the Javascript you'll need to make the callback to the waiting PHP script. It doesn't use any external libraries (like jQuery or Prototype) so be ready for bare-bones Javascript.

Categories: Resources

php|architect: oddWeek Episode #5

PHPDeveloper.org - 11 hours 49 min ago

php|architect has published the latest episode in their "oddWeek" podcast series today - episode 5 with an interview with Matthew Turland.

This week we talk with Blue Parabola Alumni Matthew Turland about the awesomeness that is Phergie [an IRC bot developed in PHP].

You can listen to this latest episode in a few different ways - you can either listen via the in-page player, by downloading the mp3 directly or by subscribing to the php|architect feed to get this and other great news and articles from the site.

Categories: Resources

Chris Hartjes' Blog: Expand your programming mind: filters in Lithium

PHPDeveloper.org - 11 hours 56 min ago

On of the frameworks rising up through the ranks is Lithium (created by some of the original CakePHP developers). In his latest post Chris Hartjes looks at the framework and a particularly useful feature it includes - filters.

As far as I can tell, Lithium is trying it's hardest to be fast, lightweight, and use all the features that PHP 5.3 has to offer. [...] I want to talk about something that I feel is a very underrated part of Lithium, the ability to define filters. This is a concept that you find in Aspect-oriented programming, and one that I imagine most programmers have never considered. Here's why I think it's a big deal.

The filters in Lithium allow you to use code from other classes without having to actually extend them. As Nate Abele says in one of the comments on the post:

While not having to extend classes or dig inside core functionality is certainly pretty central, the way I've been explaining it is that it's important because classes no longer need to know anything about each other in order to be integrated.

You can find out more about the Lithium project (and RAD-Dev) on the project's wiki.

Categories: Resources

Conferences, Speakers & Presentations

Planet PHP - 12 hours 17 min ago

There has been alot of chatter in the PHP community lately about conferences, speakers and specifically the fact that many speakers at conferences seem to be doing last-minute preparations for their presentations instead of being professional and ready well in advance.

Most recently this came out because a number of speakers for ConFoo (A PHP/Python/Ruby/Java conference in Montreal) were tweeting about working on their slides the days/nights before their talks. Some people starting taking offense at this and calling it unprofessional

First of all, I want to point out a simple fact that while yes, a SELECT FEW presenters are the types that only start making slides the night before a talk. The majority of people (myself included) who are presenting, have made our slides at least weeks in advance (if not earlier). However, we continue to tweak them up until the minute we present. We want them to be perfect, and so we keep reviewing them and modifying them. In fact, I’ve been known to change my slidedeck in response to other discussions happening at the conference, or due to information that was passed on in the Keynote.

In those rare other cases, those speakers are ones that know their topic intimately and are simply planning on having a conversation about the topic with the attendees. In those cases, the slides are less important in the first place.

But let’s put that aside for a moment, because I want to focus on something actually completely different.

The mention of the word: “unprofessional”. Speakers at PHP conferences are, by definition, unprofessional. The PHP ‘conference circuit’ if you will, is one that has grown up in a different manner than other conference circuits that I’ve been familiarized with in the past (Java, Adobe, ‘Web’, etc).

In most of these other areas, the speakers are PAID to attend. Some of the speakers in fact make their living (or a good portion of it) via being paid to present at conferences. They will get a significant payment for being there, as well as expenses being covered.

On the flip side, in the PHP conference circuit, every speaker there, in fact, is PAYING for the right to attend that conference and be a part of it. (Or, if they are lucky, their companies are covering their expenses) Sure, most of the conferences do their best to offset the expenses that the speakers will accumulate, but that’s it. The standard package involves a free conference pass, a night or two hotel per presentation, and airfare being covered. (Though some conferences, like OSCon, cover much less).

There are still so many expenses that a speaker will have. Transportation from airport to conference venue. Parking at their home airport. Meals that are not otherwise provided (usually only lunch is). Extraneous flight expenses (checked bags, etc).

All of this is being paid by the speaker (or their company) for the privilege of speaking at the conference. This is a net negative, not even breaking even, let alone being a paid speaker who would be taking their position as a ‘professional’, being paid to do a job. Heck, let’s not even take into account the direct loss of productivity that the companies take by allowing the speakers to attend (though other great benefits are gained by doing so)

In the end, my point is this. I feel that given the nature of all of these conferences. That the organizers and attendees need to understand the situation and treat the speakers not as a ‘professional speaker that they paid good money to see’. But as what they really are. Far more akin to an Open Source Developer, who is donating their time for the better good and education of the masses.

That is until at least, the situation overall changes. Where conference organizers are able to pay a respectable payment/stipend for the amount of time actually spent by a speaker in preparation and execution of a session. Also where attendees are willing to pay a conference fee that accordingly will cover those speaker payments. It would not be nearly so inexpensive as conferences now are.


Filed under: PHP "/>

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

Categories: News

Raphael Stolt's Blog: Using MongoHq in Zend Framework based applications

Zend Devzone - 13 hours 20 min ago
In a new post today Raphael Stolt shows you how to use MongoHq , a cloud-based hosting service, to host a Zend Framework application that uses the MongoDb as a backend. The tutorial focuses on the bootstrapping process to make the framework play nicely with its hosting environment.
Categories: News

Raphael Stolt's Blog: Using MongoHq in Zend Framework based applications

PHPDeveloper.org - 13 hours 34 min ago

In a new post today Raphael Stolt shows you how to use MongoHq, a cloud-based hosting service, to host a Zend Framework application that uses the MongoDb as a backend. The tutorial focuses on the bootstrapping process to make the framework play nicely with its hosting environment.

Since [MongoHq] went live a few weeks ago I signed up for the small plan and started to successfully re-thinker with it in an exploratory Zend Framework based application. [...] Therefore the following post will show how to bootstrap such an instance into a Zend Framework based application and how to use it from there in some simple scenarios like storing data coming from a Zend_Form into a designated collection and vice versa fetching it from there.

He shows how to create a new resource to make the MongoDb connection available through the entire application, to be used as needed. The resource creates the MongoDb connection based on the options from the config file and catches any exceptions that might happen along the way. As mentioned, he also includes a Zend_Form example that stores some proposal information in a collection in the database.

Categories: Resources

Brian Swan's Blog: Consuming "Dallas" Data with PHP

PHPDeveloper.org - 14 hours 24 min ago

In the latest post to his blog Brian Swan hows how to interface PHP with "Dallas", a newly introduced technology from Microsoft that lets developers and users of the Azure platform share data with REST-based APIs.

Given that MIX10 is happening this week and that Microsoft Codename "Dallas" (CTP2) was just released, I thought it would be appropriate to look at how to consume "Dallas" data with PHP. [...] In this post I'll build a simple web page that displays some of the free "Dallas" data. And, I must say, I was really surprised at how simple and easy this entire process was.

The system shares out data sets (a list is here) including things like feeds from the Associated Press, InfoUSA, NASA, NAVTEQ and quite a few others. Brian includes screenshots on how to sign up for a data feed, some PHP that can be used to connect to it (just a REST request) and a simple web page that can output the results.

Categories: Resources

Using MongoHq in Zend Framework based applications

Planet PHP - March 16, 2010 - 1:32pm
As the name slightly foreshadows MongoHq is a currently bit pricey cloud-based hosting solution for MongoDb databases provided by CommonThread. Since they went live a few weeks ago I signed up for the small plan and started to successfully re-thinker with it in an exploratory Zend Framework based application.

Therefore the following post will show how to bootstrap such an instance into a Zend Framework based application and how to use it from there in some simple scenarios like storing data coming from a Zend_Form into a designated collection and vice versa fetching it from there.

Bootstrapping a MongoHq enabled connectionTo establish and make the MongoDb connection application-wide available the almighty Zend_Application component came to the rescue again. After reading Matthew Weier O'Phinney's enlightening blog post about creating re-usable Zend_Application resource plugins and deciding to use MongoDb in some more exploratory projects, I figured it would be best to create such a plugin and ditch the also possible resource method approach.

The next code listing shows a possible implementation of the MongoDb resource plugin initializing a Mongo instance for the given APPLICATION_ENV (i.e. production) mode.

For the other application environment modes (development | testing | staging) it's currently assumed that no database authentication is enabled, which is also the default when using MongoDb, so you might need to adapt the plugin to your differing needs; and since I'm currently only rolling on the small plan the support for multiple databases is also not accounted for.

library/Recordshelf/Resource/MongoDb.php<?php

class Recordshelf_Resource_MongoDb
extends Zend_Application_Resource_ResourceAbstract
{
/**
* Definable Mongo options.
*
* @var array
*/
protected $_options = array(
'hostname' => '127.0.0.1',
'port' => '27017',
'username' => null,
'password' => null,
'databasename' => null,
'connect' => true
);
/**
* Initalizes a Mongo instance.
*
* @return Mongo
* @throws Zend_Exception
*/
public function init()
{
$options = $this->getOptions();

if (null !== $options['username'] &&
null !== $options['password'] &&
null !== $options['databasename'] &&
'production' === APPLICATION_ENV) {
// Database Dns with MongoHq credentials
$mongoDns = sprintf('mongodb://%s:%s@%s:%s/%s',
$options['username'],
$options['password'],
$options['hostname'],
$options['port'],
$options['databasename']
);
} elseif ('production' !== APPLICATION_ENV) {
$mongoDns = sprintf('mongodb://%s:%s/%s',
$options['hostname'],
$options['port'],
$options['databasename']
);
} else {
$exceptionMessage = sprintf(
'Recource %s is not configured correctly',
__CLASS__
);
throw new Zend_Exception($exceptionMessage);
}
try {
return new Mongo($mongoDns, array('connect' => $options['connect']));
} catch (MongoConnectionException $e) {
throw new Zend_Exception($e->getMessage());
}
}
}With the MongoDb resource plugin in the place to be, it's time to make it known to the boostrapping mechanism which is done by registering the resource plugin in the applic

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

Categories: News

Chris Roane's Blog: 10 Things I Wish I Knew as a Web Programmer 10 Years Ago

PHPDeveloper.org - March 16, 2010 - 11:25am

Chris Roane has put together a list of things that he wishes someone would have told him back when he was starting out as a web programmer ten years ago, helpful hints that could have made things easier in the long run.

When I reflect on my past experience as a web programmer, there are many things that I know now that I didn't know ten years ago. The learning process was valuable, but I could have been at a different spot today as a PHP web programmer if I knew these things earlier. Sometimes you don't have the info when it would benefit you the most, but my hope is that this list will give you something to reflect on.

Most of the tips a more of the general tech nature with a few non-tech ones thrown in. Here's a few examples:

  • Over Estimate Your Time
  • Don't Assume that Where You are Working is the Best Opportunity
  • Learn How to Use and Work with SVN
  • Master Organization
  • Learn Outside of Work

Read the full post for more great tips.

Categories: Resources

Gonzalo Ayuso's Blog: PHP and couchDB

PHPDeveloper.org - March 16, 2010 - 10:55am

In a recent post to his blog Gonzalo Ayuso has a brief introduction to CouchDB and how you can use it in your application. Most of the post is made up of code samples showing some of the basic relational database operations translated over to a CouchDB database (found in this class).

I come from relational database world. NoSQL is new for me. Maybe I'm wrong but I want to use INSERT, UPDATE, DELETE and SELECT statements in CouchDB in the same way I use them in Relational database. The class is focused in the HTTP Document API. There is a great tutorial here that explains the API. Now I'll show the interface I've made to perform the statements with CouchDB.

There's examples of both simple and more complex selects, updates and deletes as well as the handling of exceptions via two types he's included support for - NoDataFound and DupValOnIndex.

Categories: Resources

Christian Weiske's Blog: Running Apache with a dozen PHP versions

PHPDeveloper.org - March 16, 2010 - 9:38am

After putting together an example setup of how to run multiple PHP versions all on the same machine with as little hassle as possible, Christian Weiske is back with the second half - putting those multiple versions into Apache.

After showing you how to set up multiple PHP versions on a single machine, it's time to explain how to stuff all those compiled php-cgi executables into a single Apache web server instance.

The key lies in using the mod_fastcgi module for Apache rather than the usual mod_php one. Each PHP version gets its own CGI server and the versions are changed based on the virtual host names.

Categories: Resources

Till Klampaeckel' Blog: PHP parse errors with cgi and nginx

PHPDeveloper.org - March 16, 2010 - 8:18am

Till Klampaeckel has a very quick post about a problem he was coming across when using PHP as a CGI on the nginx web server. It was throwing errors ("client prematurely closed connection...") with no evident cause.

The issue was a PHP parse error which I overlooked when I added a new file. The weird thing is, I had nothing in the logs (E_ALL, display_errors is off, but all logs are enabled and I tailed them using multitail) and nginx only displayed a blank page. The errors above were in nginx's own log file.

The multitail command lets you run the "tail" command on more than one file at a time and view them split out in your console for easier reference. The full error message reads:

client closed prematurely connection, so upstream connection is closed too while sending request to upstream, client: a.a.a.a, server: localhost, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/tmp/.fastcgi.till/socket:", host: "localhost"
Categories: Resources

Zend Developer Zone: Zend Framework MVC Request Lifecycle

PHPDeveloper.org - March 16, 2010 - 7:57am

On the Zend Developer Zone there's a recent post from Kevin Schroder (a Tech Evangelist at Zend) about the MVC request lifecycle for the Zend Framework every time an application runs.

When I have done training for Zend Framework, one of the things that mystifies students to some extent is the whole plugin architecture and where things can go. There has been several articles written about it, but they tend to use code to describe it. [...] I had found that when I drew out the request lifecycle that it helped the students understand it better.

His diagram (seen here) lays out the full execution relationship for the request structure including where plugins, action helpers and controllers fit in the mix. He also describes it in more detail, mentioning some of the variations that could happen along the way.

Categories: Resources

Derick Rethans' Blog: Available for PHP Extension Writing

PHPDeveloper.org - March 16, 2010 - 6:40am

Derick Rethans, realizing that he wasn't ready to jump back into a full-time position just yet has decided to refocus his efforts on helping make PHP a better place with work on PECL extensions and on internals-related issues.

Instead I will be available to work on (custom) PHP extensions and internals related issues. Extensions are a great way around PHP's limitations and performance issues.

His first project is a QuickHash extension to interface with the popular StumbleUpon and works more efficiently by using more clearly defined data structures. There's no stable release yet, but keep an eye on the subversion repository for the latest enhancements.

Categories: Resources
Syndicate content