Tuesday 27 November 2012

Building PHP

Most of yesterday and today I have just been trying to get PHP installed. I was getting a build error, but didn't know what was causing it. No-one else seemed to know either.

(The problem was that it was trying to load /lib/libgcrypt.la, which doesn't exist on my system. It did this even when I told it to look in the folder (not /lib/) where I had installed a copy of libgcrypt.

So I had to keep running configure followed by make, using a slightly different set of configure options each time, until I found the configure option that was causing the make to fail.

Eventually I found that PHP would build okay without --with-xsl=$HOME/apps/libxslt. Sure enough, if I check $HOME/apps/libxslt/lib/libexslt.la, I have the following line:

# Libraries that this one depends upon.

dependency_libs=' /lib/libgcrypt.la /home/djeyewater/apps/libxslt/lib/libxslt.la -L/home/djeyewater/apps/libxml2/lib /home/djeyewater/apps/libxml2/lib/libxml2.la -ldl -lz -lm'

My guess is that when I built libxslt, Ubuntu included /lib/libgcrypt.la. But in an update this file must have been removed.

While I was trying to figure out what was causing this error, I also came across another PHP build error:

libcurl.so: undefined reference to `ldap_parse_result@OPENLDAP_2.4_2'

Some research revealed that this is likely due to conflicting ldap libs. I rebuilt curl with the option --with-ldap-lib=$HOME/apps/openldap/lib, and this seemed to solve the issue.

The strange thing is though, that after configuring CURL, it said something like "with ldap (--enable-ldap / --with-ldap-lib / --with-lber-lib) no". It seems strange that:

  1. It said ldap was not enabled even though I did use the --with-ldap-lib option
  2. That the version of CURL I already had installed contained a reference to ldap, since I would not have configured it with ldap enabled.

I had problems building icu4c as well (needed for internationalization). When I tried to build the latest version (1.5) on Ubuntu, I got the following errors:

   gcc  ...  umutex.c
umutex.c:211:1: error: conflicting types for ‘umtx_lock_50’
umutex.h:208:1: note: previous declaration of ‘umtx_lock_50’ was here
umutex.c: In function ‘umtx_lock_50’:
umutex.c:223:9: warning: implicit declaration of function ‘umtx_init’ [-Wimplicit-function-declaration]
umutex.c: At top level:
umutex.c:248:1: error: conflicting types for ‘umtx_unlock_50’
umutex.h:214:1: note: previous declaration of ‘umtx_unlock_50’ was here
umutex.c:314:1: warning: no previous prototype for ‘umtx_init’ [-Wmissing-prototypes]
umutex.c:314:1: warning: conflicting types for ‘umtx_init’ [enabled by default]
umutex.c:223:9: note: previous implicit declaration of ‘umtx_init’ was here
umutex.c:359:1: warning: no previous prototype for ‘umtx_destroy’ [-Wmissing-prototypes]
*** Failed compilation command follows: ----------------------------------------------------------
gcc -D_REENTRANT -I. -DDEFAULT_ICU_PLUGINS="/home/djeyewater/apps/icu4c-50.1/lib/icu"  -DU_ATTRIBUTE_DEPRECATED= -DU_COMMON_IMPLEMENTATION -O2 -Wall -std=c99 -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -c -DPIC -fPIC -o umutex.o umutex.c
--- ( rebuild with "make VERBOSE=1 all" to show all parameters ) --------
make[1]: *** [umutex.o] Error 1
make[1]: Leaving directory `/home/djeyewater/tarballs/icu/source/common'
make: *** [all-recursive] Error 2

So I went back to 1.4.9.2, which I had previously built successfully (and rebuilt it okay just to check). But when I tried to install it on the webserver (which runs CentOS), I got a few errors about undefined references to __sync_fetch_and_add_4 and __sync_val_compare_and_swap_4, and the build failed.

After some research, and trying various different things, I found that you needed to add CFLAGS="-march=i486" to the configure line, then it would build okay.

The other thing I was doing yesterday and today (while waiting for PHP configures / builds to process) was writing and taking photos for an article for my photo tips website.

Saturday 24 November 2012

Greeeeeeeeeee

Today I was mostly trying to finish updating my website to HTML, and then getting it working on the webserver. I had quite a few issues, but it seems to be okay now.

In the evening I also processed some of the photos I took on my afternoon walk yesterday:

Friday 23 November 2012

Being

Most of yesterday I was trying to update wordpress on the dev version of my photo website. The problem was that I was getting strict standards errors because the WP_Widget class has bothe PHP4 and PHP5 style constructors.

Researching this, it seems that an error should be thrown, and this is a bug in PHP. I tried rebuilding PHP a few times, but still got the same error I did last time about libgcrypt.la not being found.

So I decided to just turn off strict error reporting for the blog for the moment. But this didn't work, and I still got strict standards errors. I thought that the [PATH] and [HOST] directives in my php.ini must not be taking any effect. Looking in the PHP manual, I found a comment by someone else to a similar effect:

This doesn't seem to work with php-fpm.

The values defined under PATH or HOST will become the new master value for all the processes (as if they were redefined).

So, I looked for a different way that I could use different error reporting levels for my different sites. One solution mentioned on a few websites was .user.ini files. But I found these have no effect under php-fpm.

Next I found that you can set PHP_VALUE flags from the php-fpm config. But this can only be set per pool. So you would need to set up a different pool listening on a different socket for each website. This would create too many php processes and use up to much memory to work for me.

Then I found that you can actually set PHP_VALUE flags from nginx:

set $php_value "pcre.backtrack_limit=424242";
set $php_value "$php_value \n pcre.recursion_limit=99999";
fastcgi_param  PHP_VALUE $php_value;

fastcgi_param  PHP_ADMIN_VALUE "open_basedir=/var/www/htdocs";

However, when I tried this I found that the error_reporting level sent by Nginx seemed to be overridden by the error_reporting level set in php.ini.

I then found that you can use variables within php.ini. But the lack of nestable variables makes that not quite so useful.

I thought that in theory I should be able to have a default value in nginx.conf, like

set $php_value "error_reporting=E_ALL|E_STRICT";
and then override it in the website config, like
set $php_value "error_reporting=E_ALL";
And in php.ini remove all error_reporting directives so that the PHP_VALUE is not overridden.

But then I read that the PHP constants are not available outside of PHP, e.g. in httpd.conf. Instead you need to use the bitmask values.

So this morning I ran a test, using different numbers for [PATH] and [HOST] sections in php.ini and location sections in my site's nginx config. Result:

  • PHP_VALUE in nginx config is always overridden by php.ini value.
  • PHP_VALUE for location /path/ does not affect sub folders of /path/ (value set for location / is used for /path/subfolder)
  • Both [HOST] and [PATH] settings in php.ini do work, and don't seem to be overridden by previous or later settings for different [HOST] and [PATH] blocks

So, why was my blog still showing strict errors when I had E_ALL|E_STRICT set for the host, but E_ALL&~E_DEPRECATED set for the blog's path? In the end it turned out to be very simple - From PHP 5.4.0 E_STRICT has been included within E_ALL. I did read this earlier, but it didn't really sink in, and I didn't think to check my PHP version.

So a lot of work for nothing really, though I did learn some new things (can set PHP_VALUEs from nginx, can use variables in php.ini).

In the afternoon I went out and took some photos.

In the evening I listened to Will Challoner (AKA Wilson Channeller AKA Wilbert AKA Wilmington) with Billy while I worked on my kodak jr. bellows camera bit.

Wednesday 21 November 2012

Diddling

This morning I started up my IE7 VM that had had loads of errors and taken hours to shutdown before finally crashing yesterday. But it still had delayed write failed error messages today, so it seems all my waiting for it to shutdown properly yesterday was in vain. I should have just force shut it down - it wouldn't have mattered if windows had become corrupted due to shutting down since it was unusable anyway.

So I deleted the VM files, and restored by backup copy. Thankfully the backup seems to be fine, and it is currently installing the Windows updates as I write this.

I spent quite a bit of the day waiting for the IE7 and IE8 VMs to update. Then I did a bit of work on my website, and found a very strange IE7 (or jquery in IE7) bug. I had an element like <dd>Some text</dd>. When I retrieved the value like ('dd').text(), the result would be 'Some text ', with an extra space added onto the end. This messed up my site as I was doing a comparison with the value, obviously expecting the returned value to be 'Some text'. I ended up just applying a trim to the result to remove the extra space in IE.

In the evening I played on Mario Land with Billy for a bit, and bought some custom design T-shirts.

Tuesday 20 November 2012

Clicking OK on error messages

Today it seems that I mostly clicking 'OK' on error messages. That didn't really take up most of my day, but it seemed like it did.

I wanted to do some more work in moving my website over to HTML5. As part of this, I need to check the changes I'm making don't break the website in different web browsers, such as IE6 and IE7. To check these, I fired up my Windows Virtual Machines that have IE6 and IE7 on them.

Since I hadn't used the VMs for quite a while, they had a load of Windows Updates that needed to be installed. On the IE7 machine though I kept getting "Delayed Write Failed" error messages. Eventually I thought it best to just shut the (virtual) machine down, and try starting it again. But I made the mistake of clicking "Shut down and install updates" instead of "Shut down without installing updates".

It then took several hours for the machine to shut down, during which it regularly spat out "Delayed Write Failed" error messages that had to be dismissed. I didn't want to do a forced shutdown, as the message on the screen said that it may become corrupted if you don't wait for the updates to finish installing.

And when it finally finished the process, it just crashed.

Other things I did today was posting a photo to various websites. I wrote up a recipe and posted it on my recipe blog. I played Super Mario Land on the Super Game Boy on the Super NES with Billy. I sorted through some insect photos and did descriptions for one, then uploaded it.

Monday 19 November 2012

Researching

Today I finally managed to post an update on my photo website blog. Most of the day was spent researching a couple of photos so I could write descriptions for them.

Saturday 17 November 2012

exposure fusing

The last few days I have just being doing some work on the CTH website, and also trying to process a photo. I have been trying various fusion programs and also photomatix in an attempt to blend two exposures. Unfortunately I haven't been able really to get any to keep good detail in the sky while making the building in the image keep a good level of brightness. They all seem to make the building too dark for my tastes.

The exposure fusion programs I tried seem to offer very little control over how the final image turns out. Moving the sliders from one extreme to another only results in a subtle change to the image at best. Another problem was that there didn't seem to be any way to remove ghosts with these programs.

Wednesday 14 November 2012

Not drinking soup with a straw

This morning I was looking a bit more at calendar software for the CTH website (something I have been doing a bit over the last few days).

I also wrote up a recipe and posted it on my recipe website.

I found the contact details for the Hotel where I must have left my camera battery and charger. Then I looked up how much the postage would cost for them to send it back to the UK. After much searching I eventually found an online postage calculator here: Ukranian Postal Service Calculator service. Putting the weight in at 500g, I get a price of 159,70 грн. The hotel would likely want to be compensated for having to find the item, wrap it up, take it to the post office, and fill in a customs form as well. I imagine that the total cost would then exceed the cost of buying a new charger and battery from ebay (about £18).

Later in the afternoon I had a bad headache so I went to bed for a bit.

In the evening I was researching descriptions for some photos.

Tuesday 13 November 2012

A male monarch of a broad inlet of the sea where the land curves inward

Today I was baking, I made a date and walnut loaf, a (camp) coffee and walnut cake, and some almond macaroons. The macaroons didn't come out properly, but the other two look proper. Hopefully the macaroons will still taste nice as well (they spread out and didn't rise as much as they should).

Mauser's new card arrived, so I arranged sending that to him in China as well. I did some other computer stuff as well, and I think that is probably it.

Sunday 11 November 2012

Lemon Tree

I spent the majority of today still geocoding my holiday photos.

I also made some date biscuits.

Oh yes, most popular song in Ukraine:

Saturday 10 November 2012

Bah! Grr! Doh!

Today I was still doing geocoding my photos. I didn't get many done today as I had a few days where it seems I had the GPS switched off most of the day (in one case all day). This means I have to geocode them manually using Google Earth and GPS Visualizer for altitude lookup. And that takes quite a long time.

I was going to clean my camera's sensor, and give it a wet clean. There seemed to be one dust spot that would not budge that appeared on the sensor part-way through my holiday. It took me quite a while to find out where I had stored the sensor swabs and cleaning fluid.

When it came to clean the camera, I realised the camera's battery wasn't fully charged. But I couldn't find the charger or other battery. I think I must have left them in the room at the last hotel we stayed at. Doh!

I checked Booking.com to contact the hotel. They say in their FAQ that all of the hotel’s details, including telephone and email address, are provided in the online booking confirmation, confirmation email and in My Booking.com. But in the My Booking area, it was not possible to get any contact details. I think the contact details must only be available for bookings that have not been completed. And I seem to have deleted the confirmation email.

So I ordered a new battery and charger from ebay. Annoying, but I have to take some photos soon, and I don't want to rely on just having a partly charged battery. Hopefully I can find a business card or something from the hotel with their contact details in amongst all my souvenir paperwork.

Friday 9 November 2012

Geocoding

Today I was mostly still geocoding my holiday photos. So far I have about half of them done.

My replacement Nexus 7 arrived (my Nexus 7 developed a light brown-yellow mark on the top left of the screen so I phoned Google and arranged for a replacement yesterday). And I sent back the faulty unit today.

In the evening I also started making some Melonpan with Billy, and watched some Cooking with dog videos with him.

Thursday 8 November 2012

Geocoding

This morning I finished off the file moving operations I was working on yesterday.

With this done, I started work on geocoding my photos. Unfortunately I forgot a quite a few times to switch my GPS on until part-way through the day. So I have quite a bit of work to do with manually geocoding the photos.

Wednesday 7 November 2012

Copying and comparing

Today I was just was just moving files around to make room for all my new holiday photos. It takes such a long time because I have to move hundreds of GBs, both on my main hard drives, but also the backups. And then I also have to do a binary compare after each operation to make sure no files became corrupted during the move (actually a copy then delete if OK) operation.

In the afternoon I also made some cake.

In the evening I finished making the cake and showed the family my souvenirs.

Tuesday 6 November 2012

Email backlog dealing

I spent all of today going through my emails. I had over 2000 in total. Most were newsletters etc and I just deleted them. They might have contained interesting and useful information but I don't have time to read them.

Of the ones left I dealt with most of the ones from my non-personal mailboxes. I still have 84 emails left in my personal email to read / deal with.