background preloader

Php

Facebook Twitter

Sql

For:@twitter. Unit. Phpunit. Xdebug. Discussion: LinkedPHPers - receiving sms. Scaling a PHP MySQL Web Application, Part 1. Scaling a PHP MySQL Web Application, Part 1 By Eli White Tips for scaling your PHP-MySQL Web app based on real-world experiences at Digg, TripAdvisor, and other high-traffic sites. Published April 2011 Creating a Web application - actually writing the core code - is often the initial focus of a project. Ideally, you should be thinking about how your application is going to scale from the moment you first write code. I’ve worked for a number of companies and projects that over time had to deal with massive levels of Web traffic.

Performance vs. Before we go much further, we should discuss the differences (and similarities) between performance and scalability. Performance, in the context of a Web application, is how fast you can serve data (pages) to the end user. Scalability, in contrast, is the quality that enables your application to grow as your traffic grows. Scalability and performance obviously are interrelated . PHP Tuning The first of these is installing an opcode cache. <? Slave Lag <? Scheduling Tasks with Cron Jobs. Cron Jobs are used for scheduling tasks to run on the server. They're most commonly used for automating system maintenance or administration. However, they are also relevant to web application development. There are many situations when a web application may need certain tasks to run periodically.

Today we are going to explore the fundamentals of Cron Jobs. First let's familiarize ourselves with the terms related to this subject. "Cron" is a time-based job scheduler in Unix-like operating systems (Linux, FreeBSD, Mac OS etc...). There is a cron "daemon" that runs on these systems. The schedule resides in a configuration file named "crontab". Server admins have been using cron jobs for a long time. Here is a simple cron job: There are two main parts: The first part is "10 * * * *". The command itself in this example has three parts: "/usr/bin/php". This is the first part of the cron job string, as mentioned above. It consists of five parts: minutehourday of monthmonthday of week. How to Create a Web Spy with a PHP Crawler. Hook into Wikipedia information using PHP and the MediaWiki API. Introduction Most people have heard of Wikipedia: It's the ultimate repository of crowd-sourced knowledge, covering almost every subject you can think of and available to anyone with a web browser.

Regardless of what information you seek, you can find it on Wikipedia, often in exhaustive detail. And because it's publicly editable, it always contains updated and relevant information. Most people don't know one thing about Wikipedia. Hidden behind the scenes is a strong web service API, which allows developers to access, search, and integrate Wikipedia content into custom web applications. This API, which works over HTTP and returns data in a variety of different formats, including XML, is freely available to the programming public and makes it possible to create all kinds of custom web applications powered by Wikipedia's huge content database. In this article, I give you a quick introduction to this API, showing you how to integrate and use it with my favourite programming language, PHP.

Constructors and Destructors. USE PARENT::CONSTRUCT() to exploit POLYMORPHISM POWERS Since we are still in the __construct and __destruct section, alot of emphasis has been on __destruct - which I know nothing about. But I would like to show the power of parent::__construct for use with PHP's OOP polymorphic behavior (you'll see what this is very quickly). In my example, I have created a fairly robust base class that does everything that all subclasses need to do. Here's the base class def. <? Abstract class Animal{ public $type; public $name; public $sound; public function __construct($aType, $aName, $aSound) { $this->type = $aType; $this->name = $aName; $this->sound = $aSound; } public static function compare($a, $b) { if($a->name < $b->name) return -1; else if($a->name == $b->name) return 0; else return 1; } public function __toString() { return "$this->name the $this->type goes $this->sound"; } } ?

$myPet = new Animal("Parrot", "Captain Jack", "Kaaawww! ") usort($animals, array("Animal", "compare")); ?