 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Chris Jones: Using the PHP CLI Webserver to Identify and Test Memory Issues in PHP
by Chris Cornutt August 15, 2012 @ 08:35:07
Chris Jones has a new post today showing how you can use PHP 5.4's built-in web server to help test for memory issues in your application (and the language).
Rasmus mentioned on IRC how he ran the [command line] tests: simply renaming the ".phpt" test files as ".php", and invoking them through the CLI webserver. The SKIPIF sections get executed, but that doesn't affect the desired outcome of testing multiple HTTP requests with different input scripts. [Here] are some quick shell scripts I put together to automate testing the OCI8 extension with valgrind.
He uses the OCI8 extension as an example, showing how to set up these scripts to enable the execution of the tests, fire up the web server and execute Valgrind to help monitor the memory of the execution.
voice your opinion now!
builtin webserver cli test unittest phpt tutorial shell
PHPMaster.com: Taking Advantage of PHP's Built-in Server
by Chris Cornutt March 08, 2012 @ 08:17:45
On PHPMaster.com today there's a new tutorial for those on the bleeding edge of PHP using the latest released version (5.4) and a feature that comes with it - using the built-in webserver that comes bundled for testing purposes.
One of the cooler features of the new PHP 5.4 release is a built-in web server designed specifically for development and testing. Now you can write and test your code without having to have a full-fledged LAMP configuration - just launch a the built-in server from the command line, test your code, and then shut it down when you're finished. [...] In this article I'll explain some basic uses of the new built-in server and show you how to build a portable personal development server useful for quickly testing your applications
He starts with a look at how to start up the web server (a simple command line switch and host/port definition) and the resulting default phpinfo page it displays. Other options include the ability to specify a document root for your server and create a sort of "front controller" for it to route requests. They show how to create a simple application based on this that can dynamically load in the index file, a router and pass the request off to the correct file. Their example includes some "niceties" too like logging, "hosts allowed" and checks for requesting directories.
You can find their full code for this example over on github.
voice your opinion now!
builtin server recent router feature test custom tutorial
Lorna Mitchell's Blog: PHP 5.4 Built In Webserver
by Chris Cornutt January 30, 2012 @ 11:35:09
Lorna Mitchell has posted a quick tutorial about a feature of the upcoming PHP 5.4 release, the built-in web server, and some tips on doing things like routing requests and changing the hostname.
One of the big features arriving with PHP 5.4 is the addition of a built-in basic webserver for use in development environments. Quite a few of the other scripting languages have something like this so I'm very pleased to see it in PHP. Using a server like this makes it easy to quickly try out some scripts without needing to configure apache or really do anything much! I had to look up a few things to get started, so I thought I'd write them down for posterity.
She includes instructions on how to get the server up and running from the command line, updating the location of the document root with a command line option and using a simple "routing.php" script to act as a front controller. Changing the hostname is as simple as changing "localhost" to something else when starting the server.
voice your opinion now!
webserver builtin configure tutorial server
DZone.com: PHP 5.4 Will Have a Built-in Web Server
by Chris Cornutt October 24, 2011 @ 09:24:01
As is mentioned in this new post to DZone.com, one of the features of the upcoming PHP 5.4 release, including things like traits and array dereferencing support, will also have an interesting new feature - a built-in simple web server.
Yet another new feature to look forward to in PHP 5.4.0 - the CLI SAPI will now provide a built-in web server which is geared toward developmental purposes. It shouldn't be used in production right now.
The PHP manual has been updated with the latest on this upcoming feature:
URI requests are served from the current working directory where PHP was started, unless the -t option is used to specify an explicit document root. [...] If a PHP file is given on the command line when the web server is started it is treated as a "router" script for the web server. The script is run at the start of each HTTP request. If this script returns FALSE, then the requested resource is returned as-is. Otherwise the script's output is returned to the browser.
The PHP 5.4.x series is still in beta as of the time of this post - you can download the beta1 on the downloads section of the PHP site (or the Windows binaries).
voice your opinion now!
webserver builtin server beta1 download
Sameer Borate's Blog: PHP built in functions map
by Chris Cornutt January 16, 2009 @ 09:31:22
Sameer has put together a few images, the results from the Wordle website when he plugged in the names of the built-in functions included in PHP.
The application is simple. You enter a bunch of text and Wordle does the rest. The applet provides options to change color, font and layout. Just for fun I created a Wordle cloud to display php's built in functions. Two samples are shown below. The size of the font in the cloud is proportional to the number of functions starting with the particular name.
Among the largest on the list are words like "array", "get", "mysql" and "mcrypt". He used a call to the get_defined_functions() method and looped through the "internal" subarray to build his lists.
voice your opinion now!
function wordle builtin output image text size
PHPClasses.org: 3D graphics in pure PHP
by Chris Cornutt November 08, 2006 @ 08:13:00
As spotlighted by the folks over on PHPClasses.org, there's a developer, László Zsidi, who has contributed several packages to the repository - including some that work to create 3D images with just the built-in functions PHP provides.
He has developed several pure PHP components that implement impressive 3D animated graphics, like a 3D objects rendering engine, emulate a waving flag or the reflex of an image near a lake. The generated frames are combined into a single animated GIF with another pure PHP component also written by László. All these components were nominated to the PHP Programming Innovation Award for the evident creativity, demonstrating that PHP can be used for non-trivial software applications.
Some of the libraries in the listing include:
voice your opinion now!
3d graphics builtin functionality reflect gif animation images 3d graphics builtin functionality reflect gif animation images
Developer.com: Forms Validation with CakePHP
by Chris Cornutt November 06, 2006 @ 07:56:00
In this new tutorial from Developer.com, they take one of the popular PHP frameworks currently - CakePHP - and demonstrate how to make a simple form, complete with validation.
They start with a brief look at what CakePHP is and where you can get it from as well as the basics of input validation concepts. From there, it's on to the default validators that are included with the framework.
CakePHP offers several default validators capable of ensuring a value is a valid email address (VALID_EMAIL), year (VALID_YEAR), number (VALID_NUMBER), or non-empty (VALID_NOT_EMPTY).
Thanks to these built-in validation methods, some of the most common input validations are a snap. If you need a little something more, though, the framework has you covered there too with custom validators - as easy to implement as its preset counterparts. Finally, they show how to set custom messages in your form, both error and notification, and tie it all together in a simple form that validates the input for a "team name" field to ensure it's all alpha characters.
voice your opinion now!
cakephp framework form validation builtin custom message cakephp framework form validation builtin custom message
Jason Sheet's Blog: Soundex implemented in PHP
by Chris Cornutt May 27, 2006 @ 11:52:57
On Jason Sheet's blog, there's a new post that offers up a brief tutorial on implementing the soundex functionality in PHP.
Soundex is an algorithim to help determine if a word sounds like another word; it is commonly used to detect words that are incorrectly spelled or to make the suggestion "did you mean ? instead of !?" For example if you typed in smythe using soundex a program could look for other names that sound like it and find that smith and smythe sound alike.
In this article I will demonstrate a PHP implementation of soundex, in practice this implementation has little value because PHP itself has soundex() function already but this article should help you understand how it works better.
He jumps right in, mentioning the steps the script will take (seven of them) before getting right to the code. He's written up his own soundex functionality packaged up nicely in a reusable function and has even compared it to the built-in PHP soundex function for accuracy.
voice your opinion now!
tutorial soundex implementation builtin simple function tutorial soundex implementation builtin simple function
|
Community Events
Don't see your event here? Let us know!
|