Tuesday, 6 December 2011


This morning I wrote a blog post for my web development blog about using .htaccess to make a browser download an image from a link instead of just opening the image in the browser.

I noticed that the favicon for the blog was the same as the one for my photo tips website, so I thought I'd better change that. Looking into that, I found that I didn't have a full copy of my wordpress multisite in my dev (virtual) machine. So I downloaded the files that looked to be missing from the server, and updated the local database with a copy from the server.

Then I found that my recipes website wasn't working properly on my local machine. I checked up what the problem was, and I was missing a rewrite rule. The webserver my wordpress multisite is on uses apache, while my local dev environment uses nginx, so I had to have a few tries before I got the rule working properly. Then I thought about what the rule was doing, and it was sending requests for static images to a PHP page that would then serve the image file. Not good!

To do some testing on getting it working properly I really needed to get apache working in my local setup, so I spent quite a bit of time working on this.

Most of the evening I was trying to work out why PHP wasn't loading any extensions. In the end I worked out the problem was that my php.ini file has [HOST] and [PATH] sections in it. After loading my php.ini file PHP would then go onto load other configuration .ini files that loaded mysql and the other extensions. But because they were below a [HOST] section, the directives in the other .ini files were only being applied for that host, and not globally. The fix was at the bottom of my php.ini file to put [PHP]. That switched it back to the global section, so directives in the other .ini files to load the extensions were treated globally (or at least not ignored).

I still have quite a bit of work to do to get PHP and apache working properly together and my wordpress multisite running it looks like though.

No comments: