Friday 5 June 2009

Websiting

Today I was just doing some more work on my website, mainly updating it to work with the new -struct option in exiftool. Previously alt-lang arrays would be extracted as strings, but with -struct they are extracted as arrays, so I had to change my code for alt-lang array fields and some other more structure fields, like the IPTC4XMPExt LocationDetails fields.

I also tried to find out what user commands are executed as when you execute a shell command from php. However, when I tried echo `echo \$USER`; in my php script, I didn't get anything.

In the morning McRad went off to Grandad's to see him.

After lunch I went on Animal Crossing. Then I wanted to import the latest version of my database into phpMyAdmin, but when I went on phpMyAdmin, I just got a 500 Internal Server Error. I checked the apache error logs and found
[Fri Jun 05 13:40:11 2009] [error] [client 127.0.0.1] PHP Fatal error: [Zend Optimizer] Zend Optimizer 3.3.3 is incompatible with Xdebug 2.0.4 in Unknown on line 0
[Fri Jun 05 13:40:11 2009] [error] [client 127.0.0.1] Premature end of script headers: index.php


I ran phpinfo() to find out where my default php.ini file was saved, which was /etc/php5/cgi/php.ini. But when I looked there, I found it was just a symlink that pointed to /usr/Local/Zend/etc/php.ini. I opened that file and commented out the lines
zend_extension = "/usr/lib/php5/20060613+lfs/xdebug.so"
xdebug.remote_enable=on
saved it, and then phpMyAdmin worked. Obviously when I installed Zend Optimizer, it must have made those changes, but I didn't notice as my photosite has its own seperate php.ini file, which Zend Optimizer wouldn't have changed.

In the afternoon I tried to setup my database on the web server with WebFaction. However, there was a couple of problems:
  1. Database names have a maximum of 16 characters and must start with your username followed by an underscore. This meant I only had about 5 digits for my actual database name
  2. You can only have one user per database. This means that you can't have one user with lots of privileges for administering the database, and another user with not many privileges that you to connect to the database from the website


The suggestion to get round this on the WebFaction forums is to install a local copy of MySQL, which of course means you get full control over MySQL and can also install a later (or earlier if you wish) version of MySQL than WebFaction already have installed. WebFaction have produced a nice guide on how to install MySQL on their forums: How to install MySQL into your home directory. I decided to try and follow that, but first try it on my local system.

However, when running ./configure for the mysql build, I got an error message something like
checking for termcap functions library... configure: error: No curses/termcap library found

In the WebFaction thread, someone else had got that error, and the WebFaction admin said they had installed libtermcap-devel on the server to fix it.

So I googled for libtermcap-devel, but could only find rpm packages, mainly for RHEL and CentOS. So I googled for 'Ubuntu mysql termcap', and found this thread on the Ubuntu forums MySQL 4.0.27 won't compile -- needs Termcap? I followed the post that said to make sure various packages, and found that I didn't have ncurses-term and libncurses5-dev installed, and after installing them the ./configure worked okay.

After dinner I watched an episode of The Equalizer. Then I decided that actually I wouldn't try and install a copy of MySQL in my home directory on my Ubuntu virtual machine, as I think WebFaction do something with mod_rewrite to direct things to the correct ports, and since I don't know what they do I can't really copy it on Ubuntu.

I tried installing MySQL on the webserver, but got the error about termcap being missing again. I downloaded an rpm for libtermcapdevel onto the server. I tried to check whether the package was relocatable rpm -qp --queryformat "%{defaultprefix}\n" ./libtermcap-devel-2.0.8-46.1.x86_64.rpm, but just got an error
error: incorrect format: unknown tag


So I just tried installing it to a different directory rpm -Uvh --prefix $HOME ./libtermcap-devel-2.0.8-46.1.x86_64.rpm and found out it wasn't relocatable
error: package libtermcap-devel is not relocatable

So I sent off a support ticket to WebFaction so they can install it.

I did some more website stuff, just uploading files to the server, and also checked The Luminous Landscape.

Food
Breakfast: Orange marmalade toast sandwich; cup o' tea.
Lunch: Ham with sliced cherry tomatoes and iceberg lettuce sandwich; packet of prawn cocktail flavour crisps; chocolate digestive bar; some easter egg; cup o' tea.
Dinner: Sweet & Sour chicken in sauce; rice; green beans. Pudding was a big chocolate choc chip muffin. Coffee.

No comments: