After that I checked my email, then purchased some more hard drives. I was trying to decide between Samsung EcoGreen F2 1.5TB Hard Drive SATAII 32MB Cache and Western Digital 1.5TB Hard Drive SATAII 7200rpm 32MB Cache. I couldn't find any tests comparing them, but thought I might as well go with the Western Digital one given its higher spindle speed, even though it costs slightly more.
Then I tried to find info regarding discounts with Google Checkout as I was sure I had read about them giving you £5 for free or something similar, but I couldn't find anything apart from an offer that had finished a long time ago. I also found that ebuyer weren't listed with quidco, mutualpoints, or pigsback, so I couldn't get any money/points back that way either.
After that, I tried to see if I could get PHP to load a php.ini from a different location using the different locations/methods mentioned on The configuration file PHP Manual Page.
The first thing I did was to change the user.ini file for my site so that it contained all the php.ini directives needed for the site to run correctly. This meant that if my trying to load a different php.ini file didn't work, the site would still work okay (as I renamed the php.ini file PHP was using by default to make sure it would load the php.ini in a different location rather than the standard php.ini).
I'm using the spawn-fcgi init script for CentOS from the lighttpd wiki. I was editing the top section, which looks like so:
FCGI_DAEMON="/usr/local/bin/spawn-fcgi"
FCGI_PROGRAM="/usr/local/bin/php-cgi"
FCGI_SOCKET="/tmp/php-fastcgi.sock"
FCGI_PIDFILE="/var/run/spawn-fcgi.pid"
PHP_FCGI_CHILDREN=4
PHP_FCGI_MAX_REQUESTS=1000
prog="fcgi"
export PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS
RETVAL=0
start() {
echo -n $"Starting $prog: "
daemon $FCGI_DAEMON -f $FCGI_PROGRAM -s $FCGI_SOCKET -C $PHP_FCGI_CHILDREN -P $FCGI_PIDFILE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}
I started by trying to pass the php.ini location to the php cgi program using the -c command line option:
start() {
echo -n $"Starting $prog: "
daemon $FCGI_DAEMON -f $FCGI_PROGRAM -s $FCGI_SOCKET -c /path/to/my/php.ini -C $PHP_FCGI_CHILDREN -P $FCGI_PIDFILE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}
However, that didn't work as it's not actually passing the -c parameter to php, but rather to spawn-fcgi.Looking at this thread: spawn-fcgi and php.ini, I noticed that the correct form was to pass the -c parameter to php inside the -f parameter to spawn-fcgi. So I tried changing the
FCGI_PROGRAM="/usr/local/bin/php-cgi"
line to FCGI_PROGRAM="/usr/local/bin/php-cgi -c /path/to/my/php.ini"
. However, now I couldn't stop the spawned processes when I tried php-fcgictl restart
(I named my init script php-fcgictl).So I quickly scrapped that, and tried instead hard-coding the php location and -c parameter into the start function:
start() {
echo -n $"Starting $prog: "
daemon $FCGI_DAEMON -f "/usr/local/bin/php-cgi -c /path/to/my/php.ini" -s $FCGI_SOCKET -C $PHP_FCGI_CHILDREN -P $FCGI_PIDFILE
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}
I could now start and stop the php processes okay, but when I checked my phpinfo() page, I could see that the 'Configuration File (php.ini) Path' was still set to /path/to/php/lib, and 'Loaded Configuration File' was blank (since I'd renamed the default php.ini file). So it didn't work.I had a look at the man page for spawn-fcgi and also running
spawn-fcgi -h
to see the help. The manual said: -fSo after reading the manual and the help option, I tried changing the start function to:
Filename of the FastCGI application to spawn. This option is deprecated and it is recommend to always specify the application (absolute path) and its parameters after "--";
the fcgiapp parameter is directly used for the exec() call, while for starting the binary given with -f /bin/sh is needed (which may not be available in a chroot).
start() {
echo -n $"Starting $prog: "
daemon $FCGI_DAEMON -s $FCGI_SOCKET -C $PHP_FCGI_CHILDREN -P $FCGI_PIDFILE -- $FCGI_PROGRAM -c /path/to/my/php.ini
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
}
Checking phpinfo()
, I could see that the php.ini file was now being loaded, as 'Loaded Configuration File' was set to /path/to/my/php.ini. However, 'Configuration File (php.ini) Path' was still set to /path/to/php/lib. According to the PHP Manual page the first place that PHP looks for php.ini is the location specified with the -c command line parameter, so I don't understand why 'Configuration File (php.ini) Path' was still set to /path/to/php/lib.Next I tried setting the php.ini location using the PHPRC environment variable, an example of how to do this is given at spawn-fcgi ignores php command line arguments like "-c /var/www/userxyz/php/php.ini". So I reverted my previous changes, and then just changed the top of the init script to add in a PHPRC variable:
FCGI_DAEMON="/usr/local/bin/spawn-fcgi"
FCGI_PROGRAM="/usr/local/bin/php-cgi"
FCGI_SOCKET="/tmp/php-fastcgi.sock"
FCGI_PIDFILE="/var/run/spawn-fcgi.pid"
PHP_FCGI_CHILDREN=4
PHP_FCGI_MAX_REQUESTS=1000
PHPRC="/path/to/my/"
prog="fcgi"
This didn't work though, when I ran phpinfo()
it was still looking for php.ini in /path/to/php/lib, and no configuration file was being loaded.What I had to do was to also change the line
export PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS
to export PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS PHPRC
, and when I ran phpinfo()
it was still looking for php.ini in /path/to/php/lib, but my php.ini file at /path/to/my/php.ini was now being loaded.After lunch I went on Animal Crossing for a bit, then I went in the garden and found a nice Poplar hawkmoth caterpillar in the green bin as Clare had trimmed back the Salix Caprea bush yesterday and put all the bits in the green bin. I put the caterpillar back on a low branch of the Salix Caprea bush, then went and got my 100mm macro lens, as I wanted to try and get a full body shot of it, and it was much too large to get a full body shot with the MP-E.
But by the time I'd swapped my lenses (maybe 30 seconds), I couldn't find it anywhere. Either it was really fast and had run deep inside the bush where I couldn't see, or run quite a bit away from the bush, or it had just disappeared. It was pretty hot outside (a proper summer day, weird!), so I came back inside.
At the moment I have my computer on a desk in front of the window. This is good as it means I can open the window and let the breeze blow into the back of the computer to help it keep cool. However, it also means that the computer gets direct sunlight on it, which obviously heats it up.
I'm guessing that the sunshine heats it up more than the breeze cools it down, so I thought that it might be a good idea to try moving my desk and computer to a different part of the room where it won't get direct sunlight (or I can at least close the curtains to stop it getting direct sunlight). I can, of course, close the curtains with the computer where it is now, but this means that the hot air expelled out of the back of the computer hits the curtains, and has nowhere to go, so not good for keeping it cool either.
I won't move my computer right now, but when I do, I think I might take it apart and give it a good clean inside, and re-seat the CPU fan as I probably used far too much thermal paste when I installed it.
I carried on looking at the different php.ini locations, and tried to get php.ini to load from the current directory of the php script/page running, but couldn't get it to do this.
Next I tried a php.ini file in Nginx's conf directory, however that didn't load either. I tried a php.ini file in the Nginx directory, and this did load.
Then I tried a php.ini file in the php directory. This didn't load. I tried a php.ini file in the bin folder inside the php directory, and this did load.
So now I think that I know all the different locations that php looks for php.ini in and how to set the location that php looks for php.ini in, but I'm not quite sure how the actual locations where my installation of php looks for php.ini map to the locations where PHP is supposed to look for php.ini files, so I posted a reply to a thread on the WebFaction forums I had started yesterday, asking about this.
In the evening I installed APC and spent quite a long time trying to get NGinx to deny dot files. Whatever I tried didn't seem to work, then I tried clearing my cache, and suddenly I couldn't access the dot files any more. So it had probably actually been working okay with most of the different ways of trying to block dot files that I had tried, just my browser was loading the dot file from cache.
Also in the evening, I watched an episode of Simpsons with Moccle and L, and an hour of the James Bond film 'Thunderball' with them, until Ben had to go to bed.
Food
Breakfast: Lemon marmalade toast sandwich; cup o' tea.
Lunch: 1½ cheese on toasts; Nectarine; plum; Slice of sultana and cherry cake; cup o' tea.
Afternoon snack: Ice cream with chocolate sauce; cup o' tea.
Dinner: Beef burger with pus; baked beans; chips. Pudding was (hot) Lemon Meringue. Coffee.
No comments:
Post a Comment