This two year old post about Rasmus Lerdorf’s PHP scaling tips (slides) is interesting in the context of what we’ve learned since then. APC now seems common, and it’s supposedly built-in to PHP6. Still, I’d be interested in seeing an update. Are MySQL prepared statements still slow?
And that’s where Rasmus’ latest presentation comes in. We [...]
Posted September 22, 2008 by Casey Bisson
Categories: Technology. Tags: callgrind, performance, php, Rasmus Lerdorf, scaling, web applications, web development. Be the first one.
Yum up some packages:
yum install php-pear php-devel httpd-devel
Install APC using pear (the pear installer is smarter than the pecl installer):
When the installer asks about APXS, say ‘no’.Â
pear install pecl/apc
Tell PHP to load APC:
echo extension=apc.so > /etc/php.d/apc.ini
Restart Apache:
/sbin/service httpd graceful
Posted September 14, 2008 by Casey
Categories: Technology. Tags: apc, Centos, documentation, install, linux, php, rhel, system administration. 3 Comments.
I’ve been pretty aware of the risks of SQL injection and am militant about keeping my database interactions clean. Mark Jaquith today reminded me about the need to make sure my browser output is filtered through clean_url(), sanitize_url(), and attribute_escape(). Furthermore, we all need to remember current_user_can(), check_admin_referer(), and nonces.
Posted August 16, 2008 by Casey Bisson
Categories: Technology. Tags: coding standards, Mark Jaquith, php, security, SQL injections, web security, WordCamp, wordpress, XSRF, xss. Be the first one.
I’ve got a PHP script that sometimes just dies with no errors to the browser and no messages in the error log. I’ve seen this in the past with scripts that consumed too much memory (yeah, it should have issued an error, but it didn’t, and increasing the memory limit fixed it), but now the [...]
Posted August 7, 2008 by Casey Bisson
Categories: Dispatches, Technology. Tags: memory, memory_get_peak_usage, memory_get_usage, php, programming. Be the first one.
David Cloutman pointed to Craiglist’s job ads as an indicator of programming language popularity. Here’s the hit counts for “web design jobs” and “internet engineering jobs” in the Bay Area:
PHP
Java
Ruby
Python
PERL
internet engineering jobs
167
246
85
98
109
web design jobs
110
71
22
19
31
Cloutman has a few ideas for what the numbers mean, but I’m just entertained by the data. (Note: he corrected his original [...]
Posted July 15, 2008 by Casey Bisson
Categories: Technology. Tags: java, languages, perl, php, popularity, programming, python, ruby. Be the first one.
Stuck with PHP 5.1.6 on RHEL or even CentOS (and a sysadmin who insists on using packages)? Need JSON? I did. The solution is easy:
yum install php-devel
pecl install json
The pecl install failed when it hit an 8MB memory limit, and I was clueless about how to fix it until I learned that the pecl installer [...]
Posted May 28, 2008 by Casey Bisson
Categories: Technology. Tags: documentation, install, json, linux, php, red hat, rhel, system administration, yum. One Comment.
I spoke of this the other day, but now I’ve learned of PHP’s DOM functions, including loadHTML(). Use it in combination with simplexml_import_dom like this:
$dom = new domDocument;
$dom->loadHTML(’<ul><li>one</li><li>two</li><li>three<ul><li>sublist item</li></ul></li></ul>’);
if($dom){
$xml = simplexml_import_dom($dom);
print_r($xml);
}
This IBM developerWorks article has some more useful info.
Posted March 4, 2008 by Casey Bisson
Categories: Technology. Tags: domDocument, loadHTML, php, simplexml_import_dom. Be the first one.
I love how easily I can traverse an HTML document with jQuery, and I’d love to be able to do it in PHP. There are a few classes, but the PHP binding for Tidy seems to be where it’s at. The Zend dev pages make it look that way, anyway.
Posted March 3, 2008 by Casey Bisson
Categories: Dispatches, Technology. Tags: dom, html, parse, php, Tidy, web development. 3 Comments.
p0ps Harlow tweeted something about trying to get an AMP environment running on his Mac. Conversation followed, and eventually I sent along an email that look sorta like this:
If you’re running 10.4 (I doubt it, but it’s worth mentioning because I’m most familiar with it), here’s how I’ve setup dozens of machines for web development [...]
Posted January 24, 2008 by Casey Bisson
Categories: Technology. Tags: amp, apache, installing, mac, mac os X, mysql, php, sysadmin, web development. 4 Comments.
sifting results of
error_log( $_SERVER[’REQUEST_URI’] ."\n". $_SERVER[’REMOTE_ADDR’] ."\n". print_r( debug_backtrace(), TRUE ) );
Posted January 17, 2008 by Casey Bisson
Categories: Dispatches. Tags: debug_backtrace, error_log, php. Be the first one.