News Feed
Sections




News Archive
feed this:

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

Simon Champion:
PHP Upgrade Broke My Data Importer
June 27, 2013 @ 12:13:45

In his latest post Simon Champion recounts some of the issues he had when upgrading to PHP 5.4, what's usually a smooth transition from PHP 5.3. His specific problem came in a difference between the previous mysql_query call and the more-correct PDO usage.

Our office is in the thoes of a large-scale upgrade of the servers in our data center. The new version of Debian (version 7, or "Wheezy") has been officially released, having been in beta for the last few millenia, and our Ops team are slowly installing it across all our servers. This is great news, as it means we get to upgrade to PHP 5.4. Woohoo! New shininess. [...] We were ready. The upgrade should have been a breeze. But it wasn't.

He talks about his process of digging through the code trying to figure out why a call to import a CSV file into MySQL was failing. Their Data Importer component started failing with an error from MySQL about the "LOAD INFILE" not being allowed for use. He shares a "work around" that's not ideal (using exec) that manually imports the file into the database. He does point out that it could be something Debian-specific as they don't upgrade the version, just apply security patches retroactively.

We're making an effort to stick to modern PHP coding standards, so we're using PDO throughout, which makes is all the more galling. [...] Given that we do have a work-around now and everything is back up and running, I'm going to have to let this one drop; I don't have the time to try chasing it any more. But I hope this blog post will prove useful to anyone else having the same issue.
0 comments voice your opinion now!
upgrade data importer mysql infile load pdo mysqlquery

Link: http://spudley.com/blog/php-upgrade-broke-my-data-importer

Bob Majdak:
On SQL in PHP
May 16, 2013 @ 10:11:29

In a new post to his site Bob Majdak looks at using SQL in PHP and some of the challenges he's come across (some of them with his own tools). He talks about things line inline SQL, loading SQL by unique key or creating a "build object".

There is no right or wrong way, but no matter what there is no *pretty* way to do SQL inside of a PHP application. I have been having a personal debate with myself all week about how to make SQL statements nicer in an application without going to a huge DBAL package like Doctrine.

He looks at each idea and provides some of the pros and cons about each of them, noting that he hasn't quite decided on which is the best method. Some sample code is included to help clarify the points, showing the "find by unique key" version and how a more complex query might be created with the "builder object."

0 comments voice your opinion now!
sql load unique key build object pros cons method inline

Link: http://catch404.net/2013/05/on-sql-in-php

PHPMaster.com:
Bulletproofing Database Interactions with PHPUnit's Database Extension
April 10, 2012 @ 08:50:10

On PHPMaster.com today there's a new tutorial showing you how to test your application's interface with the database using "bulletproof" PHPUnit testing.

There's already a great article here that discusses Test Driven Development, but did you know that you can also test the code that interacts with your database? Especially if your application is data intensive, subjecting your CRUD code to a battery of tests is good practice that helps ensure that your application is working correctly. In this article you will be learning how to write database tests in PHP using PHPUnit and its database extension.

Included in the post is an example schema and an example of the seed data (defined as XML) for the testing to use as predictable data in its execution. His test class extends PHPUnit_Extensions_Database_TestCase (instead of the usual PHPUnit_Framework_TestCase) and a test for a basic "getArticles" method in his "IArticleDAO" class. By calling the "createXMLDataSet" method, the test loads in the pre-defined XML records and allows the correct evaluation of the assertions,

0 comments voice your opinion now!
phpunit unittest database load xml dataset tutorial


SkyTechGeek.com:
10 Exceptional Tools For Website Testing
August 23, 2011 @ 13:25:22

Sometimes a little (external) testing of your website is in order and Gagan Chhatwal has posted his list of ten tools you can use to check everything from how much load the site can take to what can be done to optimize the load time.

When maintaining or running a website , Webmasters need to keep in mind that one of the pertinent issues they will need to focus on is :Website Testing, which is not only vital for the website itself but for the user as well and one should not overlook its importance. [We have] collected some vital and free website testing tools which will help Webmasters in testing their sites thus saving users to conduct time consuming needless searches in finding the best resources pertaining to Web related tools and info.

Among the tools on the list are services like:

Most of these resources are free services, if not then they have a trial where you can see if it's a good fit.

0 comments voice your opinion now!
testing external service load validate speed monitor


Tom Rawcliffe's Blog:
session_start() blocking in php
May 25, 2011 @ 10:46:21

Tom Rawcliffe has a new post to his blog talking about an issue he found when trying to optimize a site for his company's systems - a problem with the blocking sessions caused when the pages were loaded.

Now I didn't know it but is seems that php's session handling is blocking on a per request basis. Kinda makes sense if you think about it, that if two requests simultaneously try and change a session variable then you would get constancy issues. So php handles this by making session_start() a blocking action and will wait for any other request to either finish or close the session using session_write_close().

The only reliable fix he found for the issue was to only selectively use the session in certain circumstances (or on certain pages) and closing it out when you were done with it.

0 comments voice your opinion now!
sessionstart blocking page load issue


Leonid Mamchenkov's Blog:
Disable and enable CakePHP plugins on the fly
April 25, 2011 @ 11:45:17

Leonid Mamchenkov has a quick post to his blog showing how to enable and disable (well, restrict from enabling) CakePHP plugins on the fly - no need to modify config files if you only need it for a certain request.

I am currently working on a rather large project which is based on CakePHP framework. In order to simplify the task, I've broken down the whole application into a number of CakePHP plugins. Now, however, I want to enable/disable plugins on the fly. After a brief search around I couldn't find how to do that. Asking a question at #cakephp IRC channel did it. RabidFire instantly replied with the link that gave me an idea. 30 seconds later I had a working solution.

Since the plugins extend the main AppController, all it took was a beforeFilter() method call that looks at a request parameter for the plugin name, checks against an "allowed" array and throws an exception of it's not found or can't load it.

0 comments voice your opinion now!
cakephp plugin enable load plugin dynamic beforefilter tutorial


Gonzalo Ayuso's Blog:
Speed up page page load combining javascript files with PHP
February 21, 2011 @ 13:01:54

Gonzalo Ayuso has a handy performance tip for getting that little bit extra speed from your page load times - combining Javascript with PHP files.

One of the golden rules when we want a high performance web site is minimize the HTTP requests. Normally we have several JavaScript files within our projects. It's a very good practice to combine all our JavaScript files into an only one file. [...] But if your project is alive and you are changing it, it's helpful to spare your JavaScript files between several files. [...] So we need to choose between high performance and development comfort.

He includes a quick script that runs through your javascript directory (recursively), grabs all of the javascript content from each, combines and minifies them to serve gzip compressed out to the browser.

0 comments voice your opinion now!
javascript tutorial combine minify gzip page load performance


Ole Markus' Blog:
High load websites A lock on Memcachedget
December 27, 2010 @ 12:34:14

Ole Markus has a new post to his blog looking at a technique for working with memcached and fetching data out of the store using a binary semaphore for better performance.

A typical document takes but a few hundred milliseconds to generate when a single request for the document enters the backend. The problem is that this is a highload website. In its current form, the backend serves hundreds of pages per second. This pretty much guarantees that the backend will concurrently receive cache miss on multiple languages and at the same time also receive cache miss on the pre-translated document.

Given that he wants the translated version to be the one that's always shared, a problem can come up when the cache request is "missed" and the document starts generating from multiple places. His fix for the situation is that only the first miss generates and all others see a lock on it and wait for it to be removed before successfully fetching the result. He provides code in a "LockedMemcached" class to help make it all more useful.

0 comments voice your opinion now!
lock memcache get set high load website varnish


Ibuildings techPortal:
Surviving a Plane Crash
February 16, 2010 @ 12:05:37

The Ibuildings techPortal has posted the latest episode of their Dutch PHP Conference 2009 podcast series, a session given by Peter Verhage on handling the ups and downs of server loads and traffic.

NU.nl is a well known news website in its homeland, The Netherlands, and is actively expanding into other countries. On an average day NU.nl will serve up 7 million page views; peak traffic days are more than triple that number. [...] In this [episode] we want to look at the front end that we architected for NU.nl, and how we designed the system to handle both regular traffic and peaks.

To listen you can either use the in-page player or you can grab the mp3 directly.

1 comment voice your opinion now!
dpc09 podcast session peterverhage load traffic


Abhinav Singh's Blog:
Get real time system & server load notification on any IM using PHP and XMPP
January 13, 2010 @ 11:23:15

On his blog today Abhinav Singh has an interesting post describing how to use PHP and XMPP (the Extensible Messaging and Presence Protocol) to get real-time notifications of the status of your servers and applications via instant messenger.

There are several open and closed source softwares in the market which can generate almost real time notifications for you. Most famous one being Nagios. In this blog post I will discuss, how to generate real time system notifications using PHP and XMPP. Specifically, I will present sample script using Jaxl (Jabber XMPP Client Library) for generating real time system load notifications, which can be received using any Instant Messengers.

The code for a class that uses and extends the Jaxl library is included. It sends the messages via Jabber after grabbing the contents of the "/proc/loadavg" file on the local system. You'll need to check out the latest Jaxl source and create a configuration file with your IM information, but that's about it. The rest is handled by the script - you can see an example here.

0 comments voice your opinion now!
instantmessage xmpp server load tutorial



Community Events





Don't see your event here?
Let us know!


application language laravel community developer list series project interview wordpress introduction threedevsandamaybe podcast library code configure release bugfix framework api

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework