Archive for the ‘php’ Category
Friday, November 16th, 2007
I'll be honest, this isn't very useful. The goal was to have an array of months in the least amount of code.
for($i = 1; $i
Posted in php | No Comments »
Wednesday, November 14th, 2007
Perhaps you'd like to just sent XML over post, and not have xml=your_nodes_and_stuff_here. No sweat.
$xml = urldecode(file_get_contents('php://input'));
Enjoy.
This can now be called with:
curl -d "some_xml_here" http://yoursite.com/pagename
Posted in php | No Comments »
Friday, November 9th, 2007
In trying to get a site working on cell phones, I got a "406 Not acceptable" only on the Motorola RAZR. The site loaded fine on my Treo 755 and every Blackberry I've tried.
It seems that the RAZR doesn't handle Multiviews very well, or at all for that matter. ...
Posted in apache, mobile, php | No Comments »
Friday, October 12th, 2007
I'm migrating a PHP 4 site right now. It makes me realize how far PHP has come in the last few years.
I ran across a weird bug where code was working on our dev server, but not production. I was getting the error:
session_start(): Failed to initialize storage ...
Posted in php | No Comments »
Thursday, July 26th, 2007
KCacheGrind is a very useful tool to identify bottlenecks in your applications. This will explain the steps to using it to find issues with your PHP scripts. For me, the scripts are all web pages.
I'm already assuming you're running a current version of PHP. I did this ...
Posted in linux, php | 7 Comments »
Sunday, July 15th, 2007
I installed CentOS 5 on my VMWare a few days ago. I installed gcc via yum, compiled and installed libxml2. I then tried to install PHP 5.2.3 and received this error:
configure: error: installation or configuration problem: C++ compiler cannot create executables.
It took me forever to figure this out, ...
Posted in linux, php, tips | 2 Comments »
Friday, February 23rd, 2007
Barebones list for the things you should be looking for when developing a web app in PHP. Some of it applies to all web apps, not just PHP.
Use HTML_Safe (or a similar javascript stripping library) to check for and remove javascript when you're accepting data that will be output ...
Posted in apache, php, tips | 1 Comment »
Tuesday, February 13th, 2007
Every now and then, we find that we will have a sudden increase in the number of apache processes, load average will spike up, and then go back down to normal. In rare cases, we will see the same thing happen, and the load avg spike WAY up, all ...
Posted in apache, linux, mysql, php | 2 Comments »
Thursday, October 12th, 2006
Regular expressions are awesome. However, sometimes doing everything in them is extremely difficult, or impossible. Luckily, we can flex the power of preg_replace's 'e' option to execute the replacement string as PHP code.
The reason why I found this is was I was looking for a suitable URL auto-linker ...
Posted in php | No Comments »
Thursday, October 12th, 2006
I saw a post on digg.com about how it's nice to have "pretty urls" that are easy to tell people. While i'm not sure anyone would remember rustyrazorblade.com slash some ridiculous post name, it's nice to have for search engines. Unfortunately, it didn't really go into detail about ...
Posted in apache, php, tips | 11 Comments »