Skip to main content

Posts

Writing Scalable Applications with PHP

The first part of this article, "Real-World PHP Security", appeared in the April 2004 issue of Linux Journal and covered the subject of secure PHP development. This article takes you, the professional PHP developer, one step further, by providing detailed explanations and reliable source code that illustrate the steps to follow in order to develop successful PHP applications. One day or another, every developer faces a situation in which he/she is responsible for extending the functionality of an existing application or prepare an application for an increase in use and traffic (scaling up). Our goal today is to make this process trivial by learning to develop applications based on a clean, elegant and modular design that is secure, reliable and flexible while keeping it all simple. Please refer to Figure 1, previously introduced in "Real World PHP Security" and included below. Figure 1. Our Application Model Diagram Cleaning Up the Operating Environment As a...

Running PHP Scripts with Cron

Lots of programmers like PHP for its ability to code and develop web applications fast. Code-debugging is a lot easier than with PERL or C. However, there is one thing a lot of developers are puzzled about, “How to run PHP Scripts with crontab?” Cron is normally available on all Unix and Linux distributions; if you cannot access it, contact your root or server administrator. It is a daemon which allows you to schedule a program or script for a specific time of execution. If you want to learn more about cron, click here or type “man crontab” at your command prompt. I have found myself in the need to run PHP scripts at specific times. For example, to update the content of a website, to remove expired articles, to send out e-mails on a given date and a lot more. While some may think that this is were PHP is doomed, I will show you how it’s done. A Manual crontab? The first solution that came to my mind was to run the script directly from my browser (e.g. http://www.mydomain.com/script.php...

Caching PHP Programs with PEAR

Contents: Caching in context Where to get PEAR Cache How PEAR Cache works Function call caching Output caching Customized solutions style="font-size:85%;"> Caching in context Caching is currently a hot topic in the PHP world. Because PHP produces dynamic web pages, scripts must be run and results must be calculated each time a web page is requested, regardless if the results are the same each time. In addition, PHP compiles the script every time it is requested. This overhead can seriously slow down a site with heavy traffic. Fortunately, the results of a web request can be stored, or cached, and presented to matching requests without having to re-run or recompile the scripts. Commercial products like ZendCache or open-source solutions such as Alternate PHP Cache provide a means to cache the compiled version of a PHP script -- the byte-code. While these "PHP land" solutions scratch an itch in PHP's design, "Userland" solutions can go a step...

LAMP development with XAMPP

If you have ever had to set up a Linux, Apache, MySQL and PHP or Perl installed and running at the same time you know what hassle it can be. If you are new Linux it can be a rather daunting experience just trying to set everything up, nevermind learning scripting languages like PHP, Perl and a database like MySQL or SQL Lite. XAMPP is a single packaged download from Apache Friends which provides all of the pieces of software needed, plus more you probably don't need, to make Apache installations with server-side scripting and a few database options ready to go in a testing or development environment. In this article we will focus on getting XAMPP running on Linux, it will also work on Windows and a version for Sun’s Solaris is also available. For our example we will use a Debian-based Linux distribution, but just about any flavour of Linux will work. To start, you will need to download the XAMPP package for Linux from the SourceForge Web site . The XAMPP includes the following so...

Lets Shindig

Following the introductory presentation on OpenSocial at the Google Developer Day conference in Sydney, Dan Peterson and John Hjelmstad delved into the workings of Shindig with their presentation "Apache Shindig: Make your social site an OpenSocial container". What is Shindig? Shindig, a project in Apache Software Foundation Incubation is an open source implementation of OpenSocial and gadgets. At present Shindig provides two ports, one in Java and one in PHP, both of which support version 0.7 of OpenSocial. There is work in progress for version 0.8 which will introduce the RESTful API. Some containers using the Java version of Shindig are hi5, iGoogle and orkut. There is a strong open source community behind Shindig, producing some high quality code, with updates occurring as OpenSocial evolves. Shindig Architecture Dan and John showed a diagram similar to the one below to illustrate the structure of Shindig. It is made up of three main components. |> Gadge...

Creating flexible user applications using widget technologies

Widgets and gadgets are small applications that run on your desktop or in your web browser which enable you to keep track of things like the weather forecast or share prices. But widgets and gadgets can also be used to add additional functionality to existing applications to create flexible and personalised learning environments. We spoke to Scott Wilson from JISC CETIS and the Institute for Educational Cybernetics at the University of Bolton about the potential for using widgets in educational technologies. Introduction Widget is a funny word. For some people it means a small device at the bottom of a can of Guinness for others it’s a character in Marvel comics. In technology terms desktop widgets (or gadgets) are small programmes that run on your desktop to give you useful information. The Wikipedia definition of a desktop widget is: "a small specialized GUI application that provides some visual information and/or easy access to freque...

How Jquery can help to create Web2 application

What's jQuery? Created by John Resig in early 2006, jQuery is a great library for anyone who works with JavaScript code. Whether you're new to the JavaScript language and want a library to address some of the complexities of Document Object Model (DOM) scripting and Ajax or you're an advanced JavaScript guru and tired of the boring repetition involved with DOM scripting and Ajax, jQuery will suit you well. jQuery helps you keep your code simple and succinct. You no longer have to write a bunch of repetitious loops and DOM scripting library calls. With jQuery, you can get right to the point and express yourself in the fewest possible characters. The jQuery philosophy is certainly unique: It's designed to keep things simple and reusable. When you understand and feel comfortable with the philosophy, you'll start to see just how much jQuery can improve the way you program. Back to top Some simple simplifications Here's a simple example of the impac...