I had a call yesterday with someone looking for help with Php. I explained that I don't do any Php and probably wouldn't be able to help. He countered with "Well, it's really Apache, not Php."
I still demurred, but I let him describe the problem. First, it was a Debian system (another strike: I don't know much about Debian either). There had been apt-get updates, and a reboot, and now php pages were not working at all.
Well, I hate to leave someone in the lurch, so I agreed that we could try to look at a few things. As I said, I don't know beans about Php, or even how to configure it in Apache, but we went through the obvious things: is the module being loaded? Does Php itself exist? Is there an AddType for .php files? Ayup, all the config files were as they were before the update/reboot.. hmmm..
OK, I thought, let's kill off all the current httpd processes and start up manually. Maybe that would give us a clue. I asked him to run "killall httpd". He immediately came back wth "It says no such process".
Well, OK, so Apache isn't running. That's what we want, or at least what I wanted right then.
"But it IS running", my caller insisted. "Webmin says it's running and it is serving up pages. Broken pages because Php isn't working, but it definitely is running."
OK, maybe "killall" is broken or he typed it wrong. I had him cd to /var/run and look for httpd.pid with the intention of finding it that way. To my surprise, he said it wasn't there.
Sheesh. The server is running but it isn't running? Debian can't be that weird. I was scratching my head when he said "But there's a thttpd.pid here."
Huh? I asked him to do "lsof -i:80" and sure enough, it was thttpd listening on port 80. Before I could say another word he had checked and announced "Son of a gun - thttpd is set to run at startup."
"Well, that's going to stop httpd from starting", I explained He shut down thttpd, started httpd and yelled "Yes!! It's working!"
"That's great", I said. "I can't tell you how thttpd got configured to run at startup, but at least we know why you couldn't see your Php."
As it turned out, everything wasn't quite fixed. I got email from him later saying
"It still took me another 2-3 hours to get the website up. With your help, I got Apache/PHP running, but PHP still wasn't talking to MySQL. By digging around with google for a couple of hours, I finally found that a line was missing from php.ini (extension=mysql.so). I added the line and everything came up as it should."
So apparently the apt-get update messed with php.ini also. That really sounds strange to me - I don't think any upgrade would ordinarily overwrite that. And how did thttpd get turned on?
Well, I don't know. Surely there is an explanation, but for now it remains a mystery to me. You can visit the site at http://www.poetry4kids.com if you like.
More Articles by Anthony Lawrence - Find me on Google+
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.
Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.
We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.
Click here to add your comments
Tue Jun 6 17:32:55 2006: BigDumbDinosaur
I asked him to do "lsof -i:80" and sure enough, it was thttpd listening on port 80.
As an aside, a command such as lsof -i:www is legal, assuming that /etc/services is correct. I am better at remembering service names than port numbers, so I tend to use service names anywhere I can.
Tue Jun 6 18:07:52 2006: TonyLawrence
Assuming everything is correct in /etc/services, yes.
But when a system isn't working right, I use numbers - I know most of the more common (telnet, ssh, http, https, smtp, pop, imap, etc.)
Wed Jun 7 03:44:38 2006: drag
Using apt-get in Debian if you run into a situation were a package maker has made a new default configuration in a package it will prompt you if you want to replace the old configuration with a new one. So it's likely that he got a bit happy with the 'Y' button or something like that. It's one of the reasons why using apt-get to upgrade your system can't be a fully automatic proccess. It'll hang waiting for input when it reaches things like that.
Also different interfaces may provide different results when installing software.. Like aptitude vs dselect vs apt-get may provide different dependancy resolution results.
Also apt-get will provide a list of 'recommended' or 'suggested' packages without realy explaining what they do. They won't install automaticly normally, but that depends on what interface your using sometimes. Typically they are just provided for your benifit since they will potentionally extend the functionality of what your installing.
With Apache, mysql, and php your going to have a LOT of packages, most of which you'll never use. But they all look and sound fairly usefull so the tendency is to install a bunch of extra stuff just in case you might want to use it later. One of those extra suggested packages probable required thttpd for some reason and so it got installed unnoticed with a dozen or more other packages. It's certainly not something that is provided by default.
The safest way to upgrade your system is to stick to Debian Stable and only use 'apt-get upgrade'.
With Debian Stable packages are pretty unchanging, you usually don't have to deal with version changes.. Even with security updates fixes made 'upstream' (the original developers) are backported to the version that Debian Stable uses in order to make sure that the changes are as small as possible.
With the 'apt-get upgrade' command your only going to upgrade currently installed packages. If a newer version of a package has a new dependancy change then it won't get installed. This sort of change isn't suppose to happen in Stable, but rules are made to be broken I guess. Other methods of upgrading such as 'apt-get dist-upgrade' or 'dselect' ncurses utility will include any dependancy changes.. this has a higher likelihood of breaking things.
Generally you only want to have dependancy changes if your tracking Debian Testing or Unstable (which have a high rate of 'churn') or when your upgrading from one Debian Stable to another Stable or to a Testing/Unstable.
My guess what happenned was was that he is tracking Debian Testing in order to get newer versions of PHP/Apache then what Debian Stable offers. He then hasn't upgraded for a while and did it using apt-get dist-upgrade or other tool (people sometimes use 'apt-get' as a umbrella term to cover the dpkg tools, aptitude, and other related package management items) and happenned to install some extra stuff in the proccess that wasn't installed before and also choose to replace the old config files with a newer package supplied config file.
Wed Jun 7 10:05:46 2006: TonyLawrence
That sounds right; thanks Drag.
Don't miss responses! Subscribe to Comments by RSS or by Email
Click here to add your comments
If you want a picture to show with your comment, go get a Gravatar