Monitor Script Execution with PHP

The following is a very simple script that can be used as a framework to monitor the execution of a script.

Comments are used for explanation.

/* Ensure the viewer has logged in. */
if (!isset($_SESSION['bLogged_in']))
        The escapeshellarg is there as a reminder to escape any input.  In this
        case, it is unnecessary, but if $_GET was used, it would be important.

        Use ps and grep to check for the script running.  ps -C $script may also be used.
	$ps=nl2br(`ps|grep $script`);

        This command is used to simulate execution of a script.  It just appends the date
        to a file.  
	$time_data_maker=`date >> ../`;

        Test to see if the command is executing
	if ($ps != '')
                /* Update the timestamp on the session file */
                /* Tell the browser to refresh the page in 3 seconds */
		echo '<META HTTP-EQUIV="Refresh" CONTENT="3" />'."\n";
<title><?php $_GET['title']?></title>
	font-family : "Courier New", Courier, monospace;
	font-size: .8em; 
/* If script is not running ... */
if ($ps == '')
	echo $script.'is not running<br />';
	echo $script.'is running<br />Current Status<br />';
        /* Display contents of file */
	echo nl2br(file_get_contents('../'));


  • Refreshes stop when script stops
  • Page display prolongs session until it finishes
  • Session id may be used to identify data file, script name can make a nice extension
  • Placed in an iframe, with a print button, this is a very nice interface

Secure CSS For ADNs

This rewrite rule allows CSS requests to run through css.php, which can substitute color attritubes on the fly to allow a single application to be supported by multiple skins, and have greater immunity to cross-site scripting attacks.

RewriteEngine On

RewriteRule ^(.*)\.css$ css.php?d=$1

Key considerations:

  • sed may be the best substitution strategy, instead of PHP, because it is probably faster, and little to no development would be required
  • Caching should be done carefully to ensure the files are not recreated unnecessarily, and files that don’t exist should be created. If the source .css file has changed, the recolored one must be updated.
  • One may use the REQUEST_URI to select the .css files
  • Backend management of the .css file identifiers will be required if they are dynamic. This implies the ability of a user to be able to select colors and store the scheme. If they are fixed, it is simpler.
  • This is not really intended for individual user customization and user experience, but to allow a single installation of an application to support multiple skins. With that in mind, it is assumed there would be a fixed set of .css files, with a default used in the event of an invalid file request, and the .css files would be managed manually by the design/engineering team.

Application Delivery Networks - An Excellent Application of

The link above suggests integrating diverse, externally hosted applications with polished designs. This is an excellent use of, because the volume of design translation may be massive.

The basic approach would be to identify those CSS files related to color, get the color attributes, and apply new colors using robots.wizard. You could skin many applications, very quickly, even if their original color schemes were very different.

The key to success will be to limit the skin colors, and augment them with images. If you have a very complex, colorful, comp, the variation in target application color schemes may make it difficult to get a consistent color set out of robots.wizard. You can remove colors from the image, without modifying it, in Step 1 of robots.wizard.

A New Paradigm in Web Applications

Services such as Ning (, Shopify (, and WordPress’ blog system are making it possible for people to provide a social network, ecommerce, or blog with little to no technical experience. Many of these people will succeed, their sites will become popular with a community, their products will be purchased, and the blogs will be read. Eventually, they may want to integrate their initial offering with additional applications, using the same approach.

Web companies that can gracefully integrate diverse, distributed, externally-hosted applications into an attractive, polished, cohesive site, will provide a path for independent people to transition their basic, hosted, presence on the web into more robust site.

An extension of this is the ability for a collection of organizations to indentify their content as related, and their group as cooperative. The opportunity is in designing and integrating the independent elements gracefully.

The engineering required in these cases is the management of the CSS and supporting elements, definition of system common, site common, application common, and page specific elements. Browser caching must be handled very carefully, to ensure optimal use of the cache, while delivering the latest versions of the files. Sourcing of files is also key, meaning creating a filesystem and server architecture that will work well for many designs.

Designers will have to consider the same issues, and work with the engineering team to achieve the best solutions.

Companies should avoid including language in the design (particularly images), or creating an appropriate architecture to allow multi-lingual sites with language in images.

The real value here is that people can use a hosted service to test an idea. They can bring a shop to life in minutes, manage it themselves for months, then turn to a company for help transitioning it into a full site and system with a custom design and additional features. This greatly reduces the required administration of applications, because when the clients approach the web companies, they already know how to use the application and the content is established. Improvements can always be made, but the majority of the work will be done (as with any project, sometimes, the work done may be done poorly as well).

If a web company identifies a potential client that doesn’t have the budget for a custom solution, refering them to a hosted solution with an offer of future extension is a nice way to help people and create the possibility of a relationship later.

Contribute and Share

Participating in a forum related to professional issues is a great way to learn and share. Whether you need help, or answer requests, you will almost always learn from the other posters.

I like ProgrammingTalk (link above) - there is a wide variety of web-related material. Another excellent forum is

LinkedIn is also great, the topics span a wide spectrum and you can really learn a lot from the other members.

One caution - every post you make should be professional. If a sarcastic comment comes to mind, or silly response, type it in Notepad and save it on your desktop. Don’t post it publicly. And, respect others, don’t ask for help for a site that people may find offensive, remove any identifying content and focus on the technical issue.