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 and braces as lines, as well as comments. Oh well. It’s a good approximation.
Edit: There are 172,189 lines of code in phpbb3.
linux
- 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 handful of times, and I didn’t know what this was. First I installed expat from source. It didn’t help.
- 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 using PHP 5.2.1. These instructions are based on a Unix/Linux server, if you’re running Windows I can’t help you. **Step 1: Install XDebug.
- 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.
- 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, but I had to install the g++ library, then it compiled fine. yum install gcc-c++
- 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 up for one on your own. Now, to hit their api and update your status, they require you use HTTP Basic Authentication.
- 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*
- 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 rookie mistake, but I never claimed to be the awk master. So, always write: awk '{print $1}' somefile.txt and you will avoid a headache.
- 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, or this is just less code. Or I wanted the awk and xargs practice. Whatever. mysql database -e "select id from category where foreign_key in (2771, 2769, 2766, 2772, 2767)" | awk -F\| '{print $1}' | xargs -ivar mysql database -e "call move_category(var, 5666)"
- 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 queries appear locked up, and the server must be rebooted. I am looking for ways of determining what caused this. I should note that it happens extremely rarely, and has never shown up in a load test.