Skip to: Site menu | Main content

aplus's blog

PHP errors on Drupal 4.7.x at Dreamhost: "Premature end of script headers: php.cgi""

I’m using a Drupal 4.7 on this website and for all my pages it was showing a “page not found” error. The error.log file said
Premature end of script php5.cgi
Switching over the php4 didn’t help either, just the error message changed a little:
Premature end of script php.cgi

After disabling some modules in drupal, I found the the
Textile module is the culprit. The Drupal 4.7 version is not maintained anymore and is from nov. 2006. I didn’t want to upgrade to Drupal 5.x so I got to find another solution.
A solution is here http://leon.info.tm/en/salvation-textile-drupal-module, but it was to much work for me, the lazy programmer that I am.

So I went to the php.net website and on the PCRE docs I found that starting with PHP 5.2 two new configurations variables appeared: pcre.backtrack_limit and pcre.recursion_limit, both with default “100000”.

The solution seemed simple. Open for editing sites/default/settings.php and add these lines:
// fix for textilePHP pcre bugs ini_set('pcre.backtrack_limit', '1000'); ini_set('pcre.recursion_limit', '1000');

The default for this variables are 100,000, which due to bugs in Textile or PCRE consumes all the available process stack and eventually crashes PHP. I guess you were wondering what those “core” files were doing in your site. Those are
“core” dumps of the memory when PHP crashes. You can safely delete them.

Remote Linux help available / not only in Chicago, but US and abroad

Remote Linux help and configuration is available from A+ Computer Services, a Chicago based IT support company.

Just use the email address contact@apluscompuservices.com to set up a instant messenger (AOL, Yahoo, Jabber) session and let me help you with your Linux server. Supported systems are CentOS, Redhat and RHEL, Debian and Ubuntu.

Prices are very reasonable and the Linux support is top-notch. As an example, I’m attaching a e-check from paypal from a customer in Indianapolis for whom I solved an “exim not sending mail from php application problem.”

Paypal payment for remote Linux administration

How to setup DDNS in CentOS/RHEL Linux keeping SELinux active

If you may have a large LAN, maintaining the DNS and DHCP server on Linux can be time consuming if you edit the zones and the dhcpd.conf file by hand. As a consequence, DDNS updates for ISC dhcpd server and BIND9 have been available for a few years.

But SELinux and CentOS/RHEL the procedure explained in the hundreds of tutorials on the net about is not sufficient. Let’s start with a good and short tutorial for Fedora, a very close cousin of CentOS/RHEL:

A very important step is to set the permissions, because you probably made the zone files from the root console:
chown named:named /var/named/var/named/intranet.zone
chown named:named /var/named/var/named/intranet.reverse.zone
chmod 770 /var/named/chroot/var/named

After that, set the security context for SELinux:
chcon system_u:object_r:named_zone_t intranet.reverse.zone
chcon system_u:object_r:named_zone_t intranet.zone

Now, everything should work, right? Well, you will get this error:
Mar 20 18:53:31 localhost kernel: audit(1174434811.548:82): avc: denied { write } for pid=6969 comm="named" name="named" dev=md3 ino=957224 context=root:system_r:named_t tcontext=system_u:object_r:named_zone_t tclass=dir

It seems the named process needs to write to the zone file and SELinux it does not let him. Use the swiss army knife of SELinux: tail /var/log/messages | audit2allow. You will find out that you need to allow named_t named_zone_t:dir write;.

To edit SELinux policies on CentOS you need do yum install selinux-policy-targeted-sources. This creates a the src directory in /etc/selinux/targeted.

Take the line that audit2allow spit out to you and add it to the file /etc/selinux/targeted/src/policy/domains/program/named.te. Run make load in the src/policy folder. Sweet! Now it should will work! Well… guess again, because
only the error message has changed, subtly:
Mar 20 19:19:40 localhost kernel: audit(1174436380.095:87): avc: denied { add_name } for pid=6970 comm="named" name="intranet.zone.jnl" scontext=root:system_r:named_t tcontext=system_u:object_r:named_zone_t tclass=dir

You will need some this line: allow named_t named_zone_t:dir add_name;

I’ll save you the pain and give you all the lines that you need to add to named.te:

allow named_t named_zone_t:dir write;
allow named_t named_zone_t:dir add_name;
allow named_t named_zone_t:file create;
allow named_t named_zone_t:dir remove_name;
allow named_t named_zone_t:file write;

And, success!!

Mar 20 19:41:41 localhost named[7669]: client 127.0.0.1#33008: updating zone 'intranet/IN': adding an RR
Mar 20 19:41:41 localhost named[7669]: client 127.0.0.1#33008: updating zone 'intranet/IN': adding an RR
Mar 20 19:41:41 localhost dhcpd: Added new forward map from HP29674251632.intranet. to 192.168.1.252
Mar 20 19:41:41 localhost named[7575]: journal file intranet.zone.jnl does not exist, creating it
Mar 20 19:41:41 localhost named[7669]: client 127.0.0.1#33008: updating zone '1.168.192.in-addr.arpa/IN': deleting an rrset
Mar 20 19:41:41 localhost named[7669]: client 127.0.0.1#33008: updating zone '1.168.192.in-addr.arpa/IN': adding an RR
Mar 20 19:41:41 localhost named[7669]: journal file intranet.reverse.zone.jnl does not exist, creating it
Mar 20 19:41:41 localhost dhcpd: added reverse map from 252.1.168.192.in-addr.arpa. to HP29674251632.intranet.

Some Linux admins turn off SELinux just because of this extra configuration steps when you do something unusual, like Windows Domain authentication with kerberos/winbindd or , like in this case, Dynamic DNS updates. Remember that chcon, audit2allow and the targeted-sources package are your allies.

How to use Performance Monitor to troubleshoot poor performance

I had a computer that was very slow for it’s processor and memory: a Celeron 2.4Ghz with 512Mb RAM. Extracting the files from a 4MB zip file took 4 minutes and it took the processor to 100%.

Opening task manager (with alt+ctrl+del), and then going to the tab processes and sorting by CPU usage was telling me that “explorer” was taking all this processor power! When you see that, usually you need to think if

  1. Is the process really working at user level? or…
  1. Are there some system calls that are going wrong?

To analyze that, you have “Performance Monitor”: click start -> run, and type “perfmon”, OK. What you want to watch for is:

  • leave on the cpu usage counter on
  • add privilege time counter (very important)
  • add system calls counter
  • feel free to add some more that are helping you, like IRQ/s (which may detect a hardware problem), disk queue, bytes read/s, bytes written/s

Adjust the scale on each counter that is too low or high flat on your graph. Maybe you will end up with a graph configuration like mine:
Performance Monitor watching system calls and processor usage

What did perfmon told me? I found out that the privileged time counter was following closely the cpu usage counter and the system calls counter literally exploded upwards when I tried to to a simple unzipping.

Something was interfering with normal file open/read/write operations. It could have been only two:

  1. A virus
  1. An antivirus

The computer had the silly Yahoo SBC Online Protection installed, with a rebranded CA(Computer Associates) antivirus that “never catches anything”. I uninstalled that and the computer was snappy as it was brand new.

Always look out for misbehaving antiviruses and real time protection programs when you’re troubleshooting poor performance on your own computer.

Sony Vaio laptop repair (overheats) (on Broadway & Granville)

I had to repair a Sony Vaio notebook displayed symptoms of overheating because of dust: very noisy fans and random shutdowns.

The Sony support page for PCGFRV31 does not provide a service manual. So I had to go back to the trusty old google. The two most helpful pages were:
A guy taking apart his Vaio, a different model, but helpful nevertheless
A company that’s charging $150 to repair your Vaio laptop.

There were a couple of dust bunnies inside of the heatsink and I almost hit a wall when I couldn’t (at first) remove the CPU from the heatsink because it was glued to it. With the use of a hammer and a razor blade – that’s everyone in the business uses, no kidding – I managed to get it off from the heatsink.

When it booted up I was the happiest man on the planet. I always have a feeling of joy when I fix a computer problem, but with that laptop it was really a fight – man vs machine to fix it.

Data recovery services - hard drive crashed (near Ashland & Bryn Mawr, Chicago)

Where this computer repair and data recovery service call was located: near Ashland & Bryn Mawr, Chicago).

After some previous appointed work I was back at he office at about 1:00 PM. Checked my email, checked website statistics… and then nothing to do.

So I guessed… right after I thought “This is going to be a slow day”, I got a phone call from a feminine voice (for unknown reasons, most of my clients are male):

“Are you doing data recovery services?”, asked my new customer, Sarah. “I can’t get into Windows anymore”.

“Do you see the windows logo screen?”, I asked, knowing that we don’t do much data recovery if the hard drive is a “dead lemon”.

Newest Starwars Galaxies game crashes computer with blue screen (near Grand & Damen)

Where this service call was: near Grand & Damen, Chicago

Lain called me at 8:20PM asking me if we offer 24/hrs service. I’m not usually available at this hour, but luckily I was still at the office, doing some web programming (a big in-house project coming the following months done in Ruby on Rails). He said that he has a new game, Star Wars Galaxies that crashes his computer. I wrote quickly in the service call log the entry and went on my way. In 25 minutes I was there (from Ravenswood & Irving Park).

The problem was always reproducible: the game loaded OK, the login screen and whatnot, until it actually entered the 3D World. Then the computer crashed with a BSOD.

How is the competition in the computer repair business?

Today I just got an email from one prospective customer, Joe, asking me the rate for “rate for onsite housecall out in Schaumburg”. He supposedly needed his Windows reloaded and hooked up to his existing wireless network.

I replied him right away:
Hi, Joe
Most of my clients are right in the city of Chicago and some in the northern suburbs, but I would love to expand my business in the west suburbs. I guess that Schaumburg would be ok for me to ask $30 extra. Please let me know if that’s ok for you. Thanks.

After a few hours and no response and the suspense building up, I decided to google up his name… guess who was the mystery shopper?

It was Joe, K., who operates a computer repair business too, in Schaumburg and O’Hare areas. His going rate for housecalls is $100 and mine would be just $80 so his business model is in danger! :)

“Don’t start a fight about this.”, a coworker told me.

“What he could do? Packet flood me?” I answered laughing :)

“He could drive all the way from Schaumburg and kick your ass…”

So, Joe, if you’re reading this, as you stand at your computer now, reading this very lines, you may start to realize how funny is this.

I just came from a trip in San Francisco so I want to feel only good vibrations and no bad karma. In an effort to keep a peaceful atmosphere between the small Chicago computer repair shops, I will increase my rate for Schaumburg to $100.

"NTLDR is compressed" error on Windows XP - telling you to press alt+ctrl+delete to reset your computer (California & Devon)

I just had another client with that error on his computer. This service call was near California & Devon, almost on Lincolnwood.

The “NTLDR is compressed” error was not fixed by the usual combination of fixmbr and fixboot from the Windows XP Recovery Console.

The common way to fix this OS load problem is to run in the recovery console the command “attrib -c \ntldr” and then reboot. The errors with the ntldr (NT Loader) may come from a lot of reasons: a missing boot.ini (which needs to be restored) or a missing ntdetect.com or from a severely fragmented MFT root folder (which comes from writing a lot in the root folder of the system partition – that should not happen in normal usage – and this issue was fixed in Windows Service Pack 2). Some more technical background is given in Microsoft Knowledge Base article 320397