Category Archives: PHP

Implement Selenium tests

Installing Selenium 1.0 and write tests with PHP _ The documentation is very good: http://seleniumhq.org/docs/ _ Donwload Selenium RC from here: http://seleniumhq.org/download/ _ When you extract it, there will be a directory with the server and a number of directories … Continue reading

Posted in PHP, Web Development | Leave a comment

Process forking in PHP on Linux

Command Line with PHP _ Introduced with PHP 4.3 (2002-12-27) _ PHP packed with very useful functions: exec, shell_exec, passthru _ PEAR package Console_CommandLine to easily handle arguments and options _ You can do system administration and release management with … Continue reading

Posted in PHP, System Administration | Leave a comment

How to benchmark apache+php

This is to see whether you server is CPU-bound or RAM-bound. We have to stress it and see which one of those components gets saturated first. If that is the RAM, we can add easily more RAM. The amount of … Continue reading

Posted in Apache, PHP, System Administration | Leave a comment

PHP Conference – London 2010 – Summary

Free notes from the PHP London Conference 2010  - http://www.phpconference.co.uk Lost art of Simplicity by Josh Holmes (working in Microsoft)   –  http://www.slideshare.net/joshholmes/the-lost-art-of-simplicity – http://www.joshholmes.com/blog/2009/04/29/TheLostArtOfSimplicity.aspx _ NIH (not invented here) syndrome   -  people want to develop everything internally _ The … Continue reading

Posted in PHP | Leave a comment

PHP – Plurilize

This is a very good post: http://kuwamoto.org/2007/12/17/improved-pluralizing-in-php-actionscript-and-ror/ We have test it in the office and it works great!

Posted in PHP | Leave a comment

PHP function to get the most recurrent words in a file – it uses Linux command line

/** * Extracts the most recurrent one-word and two-word terms in a file * Filters out some common stop words and you can also pass extra ones * * @param string $filepath * @param int $minWordLength – the minimal word … Continue reading

Posted in Linux Command Line, PHP | Leave a comment

PHP – Nice Debug Trace

<?php echo parse_backtrace(debug_backtrace()); function parse_backtrace($raw){ $output=”"; foreach($raw as $entry){ $output.=”\nFile: “.$entry['file'].” (Line: “.$entry['line'].”)\n”; $output.=”Function: “.$entry['function'].”\n”; $output.=”Args: “.implode(“, “, $entry['args']).”\n”; } return $output; } ?>

Posted in PHP | Leave a comment

POST Request with PHP and with HTTP Authorization

function POSTReqeustWithHTTPRequest($message, $username, $password) { $context = stream_context_create(array( ‘http’ => array( ‘method’ => ‘POST’, ‘header’ => sprintf(“Authorization: Basic %s\r\n”, base64_encode($username.’:’.$password)). “Content-type: application/x-www-form-urlencoded\r\n”, ‘content’ => http_build_query(array(‘status’ => $message)), ‘timeout’ => 5, ), )); $ret = file_get_contents(‘http://example.com/update.xml’, false, $context); return $ret; }

Posted in PHP | Leave a comment

VBulletin – Make Everything UTF-8

_ MySQL – database charset _ config file – database charset _ Admin -> Languages: HTML Character Set must be UTF-8 _ Check the Meta Equiv is UTF8

Posted in PHP | Tagged | Leave a comment

The Unexpected SQL Injections

http://www.webappsec.org/projects/articles/091007.shtml

Posted in PHP, Web Development | Leave a comment