Archive for the ‘linux’ Category

How many lines of code?

Monday, May 5th, 2008

I was curious how many lines of code were in PHPBB 3. I only wanted to know about the .php files. find . -name '*.php' -exec wc -l {} \; | awk '{ SUM += $1 } END {print SUM}' The downside to this is that it includes whitespace ...

Problems Installing Subversion From Source On CentOS

Wednesday, March 26th, 2008

I was setting up a new server for someone, and encountered this error while I was trying to build svn /usr/bin/ld: cannot find -lexpat Now, while I can do some things on that a sys admin can, I am by no means a sys admin. I have only installed svn a ...

PHP: Setting Up XDebug with KCacheGrind

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 ...

Apache Compile Error

Tuesday, July 24th, 2007

I got this while recompiling apache (2.2.4). configure: error: Cannot use an external APR-util with the bundled APR After searching around for a while, I found a tip here to include this in my configure: --with-included-apr Built on MacOS X 10.4.

PHP compile error on CentOS Install

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, ...

How to use CURL to Hit a Web Api Using HTTP Basic Authentication

Wednesday, May 30th, 2007

Curl is a fantastic application. The most basic use of curl is very straightforward, just put in a web site's url: curl http://twitter.com If you copy and paste the above code, you'll get the HTML output of twitter's home page. In order to demo this, I created a twitter account. You can sign ...

Public / private key set up but not working?

Wednesday, April 25th, 2007

When you set up public key authentication, make sure your authorized_keys2 file has the permissions set to 600. If you don't, it's likely that you will still be prompted for your password. chmod 600 authorized_keys*

Awk does not work as expected with double quotes

Thursday, March 22nd, 2007

Of course, I felt like an idiot after being completely confused by this for about half an hour. Consider this: awk "{print $1}" somefile.txt This does not work as I had expected. The reason is because the $1 is evaluated within double quotes, (not single quotes). Yes, it's a ...

Using a result set to call stored procedures for ad hoc queries

Friday, March 9th, 2007

Using mysql -e's feature, combined with awk and xargs, I was able to call an existing stored procedure repeatedly for a resultset. Yes, I could have written another stored procedure to do this, I realize. But I guess I like doing things the hard way. Either that, ...

What caused that load spike?

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 ...