Category Archives: Infrastructure

Installing OCI8 on Ubuntu 12.04 LTS Precise (with PHP 5.2.x)

Recently I wrote about installing PHP 5.2 on Ubuntu 10.04 LTS, then again about how I also got PHP 5.2 working on Ubuntu 12.04 LTS Precise in the same way. Well now I’m trying to get OCI8 working in this environment and there were a couple of obstacles.

Firstly, an updated package somewhere along the line broke my fix to libtool.m4. So that needed fixing with:


sudo mv /usr/share/aclocal/libtool.m4 /usr/share/aclocal/libtool.m4.bak
cat /usr/share/aclocal/lt~obsolete.m4 /usr/share/aclocal/ltoptions.m4 /usr/share/aclocal/ltsugar.m4 /usr/share/aclocal/ltversion.m4 /usr/share/aclocal/libtool.m4.bak | sudo tee -a /usr/share/aclocal/libtool.m4

Then you need to follow the manual OCI8 installation method the bit your after starts: “For a manual install, download the PECL OCI8 package”.

Once you get to the following command:


phpize

It’s time to fix things up. The libtool in the package just won’t work when you go to run make. So remove it and link to your local version.


sudo rm ./libtool
sudo ln -s `which libtool` ./libtool

Now you can carry on with the instructions. You may get a few warning messages, but everything should be fine.

Hope that helps,

Steve

PHP 5.2.x with APC on Ubuntu 10.04 LTS Lucid (via Hardy)

As part of a move to virtualise our last remaining physical servers and build more scaling capability and resilience into our web serving infrastructure we have a specific need to run a couple of legacy apps on PHP 5.2.x. In the future when we’ve managed to fit in testing a bug fixes we’ll have these apps running on PHP 5.3, or even 5.4, but for now this need exists.

We have templates for Ubuntu 10.04 LTS, and since this is the middle ground between when PHP 5.2 was last shipped with Ubuntu in 8.04 LTS, and the latest and greatest 12.04 LTS I figured it’d be more secure, efficient and easier to implement it there!

Thankfully most of the work has been done for me.. Randy Fay shows how to run Karmic’s PHP 5.2 on Lucid but Sergius14 suggested pinning PHP 5.2 to the Hardy versions and I tend to agree with the reason. I want the latest security patches bundled in!

So taking Randy’s /etc/apt/sources.list.d/karmic.list and /etc/apt/preferences.d/php file and changing karmic to hardy in the file name and file contents gets us up and running. See the attached files to see what we’re running, if you use these files remove the .txt suffix from the file name.

Because we’re now looking at double the amount of packages, apt is going to complain, we need to increase it’s cache. If you don’t you’ll get an error when you run sudo apt-get update so, following the fine instructions on how to increase your apt cache limit we’ll do this as a one liner:

echo 'APT::Cache-Limit "100000000";' | sudo tee -a /etc/apt/apt.conf.d/70debconf

Next let’s update and install libapache2-mod-php5 to pull in PHP5, Apache2 and the basics.

sudo apt-get update
sudo apt-get install libapache2-mod-php5

Check it’s working by visiting the ip of the server in a web browser.

http://youripaddress/

To check PHP’s working we’ll create a new file calling the phpinfo() function.

echo -e '' | sudo tee /var/www/phpinfo.php

Check http://youripaddress/phpinfo.php to ensure PHP is installed and correctly running. If your browser tries to download a file, you might need to restart Apache to enable PHP.

sudo /etc/init.d/apache2 restart

Now we need APC (There’s a good article on Wikipedia about PHP accelerators, of which APC is one). The php-apc package installable from APT has some unmet dependencies because we’re using Hardy’s packages. We can circumvent that by installing it via PECL instead.

This route isn’t without a few complications because we’re using Hardy’s PHP5.2 some files aren’t in the right places, or automatically included with dependencies.

I added to Randy’s /etc/apt/preferences.d/php the following to get the PHP5 dev files for PECL to run.

Package: php5-dev
Pin: release a=hardy
Pin-Priority: 991

Now we’ll get php5-cli, php5-dev and php-pear (which includes PECL), we’ll update the PECL channel whilst we’re there and then try to install APC with PECL.

sudo apt-get install php5-cli php5-dev php-pear
sudo pecl channel-update pecl.php.net
sudo pecl install apc

AGH!

Errors! As I said before, some files like libtool.m4 and ltmain.sh are in the wrong places and need to be symlinked.

sudo ln -s /usr/share/aclocal/libtool.m4 /usr/share/libtool/libtool.m4
sudo ln -s /usr/share/libtool/config/ltmain.sh /usr/share/libtool/ltmain.sh

libtool.m4 is also missing a few bits since libtool.m4 has been broken down into multiple files so we need to concatenate them back together and append to libtool.m4:

cat /usr/share/aclocal/lt~obsolete.m4 /usr/share/aclocal/ltoptions.m4 /usr/share/aclocal/ltsugar.m4 /usr/share/aclocal/ltversion.m4 | sudo tee -a /usr/share/aclocal/libtool.m4

We also have a missing pcre.h header file. To get that we need libpcre3-dev.

sudo apt-get install libpcre3-dev

This should be it, so lets use PECL to download, compile and install APC (accept all the defaults), enable it in the php.ini and restart Apache.

sudo pecl install apc
echo -e '\n\nextension=apc.so' | sudo tee -a /etc/php5/apache2/php.ini
sudo /etc/init.d/apache2 restart

Now it’s time go back and check http://youripaddress/phpinfo.php to see if APC is enabled!

Congratulations if you’ve read this far and if it helped!

Steve Daniels

Computing facilities on campus

It’s the start of a new academic year so now is a good time to recap places on campus where you can access computing facilities – it’s more than just the library.

The Hub

This brand new building in the centre of campus has a number of express PCs for quick access to the internet. On the first floor there are six pod seating areas with integrated touch screen computers for group working and there are plenty of tables and areas to sit and use your own laptop. There’s also a giant 126 inch video wall with PS3, Xbox 360, Wii and a PC attached!

Wireless

If you’re bringing your own device to university then you can connect using Wi-fi to access the internet across the campus including cafes and restaurants, lecture theatres and halls of residences. Connect to “EdgeNet” and login with your student number and password.

Library

Open access computers and printing facilities. More information.

LINC

Approximately 200 PCs (47 are available 24 hours a day with your UniCard). More information.

Faculties and Department buildings

Many Faculties and Departments have additional computing facilities to support their students. These rooms may contain specialist hardware – music rooms in Performing Arts for example – or run software required for certain modules.

Dashboards

Colorful house number, two
In my previous post I talked about Wallboards. As an aside, I’ve just started experimenting with using some old O2 Joggler’s as miniature information radiators in my new home. But that’s another blog post for another blog! This time round I’m covering dashboards!

Dashboards are beautiful things that seem to be getting slung haphazardly into all sorts of applications these days.. “view this on your dashboard” “view that on your dashboard” “configure it from your dashboard”.. blah blah blah. Dashboards can be a Good Thing™.

Here at Edge Hill University we run the our GO portal, we’ve written about GO many times so I won’t go into detail here, suffice to say it’s a portal that gives you tabs – your Home tab is effectively your “dashboard”. On my GO Home tab I’ve got some useful information shown to me – it stops me hunting around various places, all of it is Edge Hill specific.

GO home tab

On there I’ve got mail, Edge Hill rss feeds, staff directory, GO news, the forum – all bits of information I regularly check. The dashboard pulls it all together so I can access it at a glance. Saving me a lot of time.

I do the same with JIRA and Fisheye as you can see below:

JIRA dashboard

All my development information needs at my fingertips…

Do you pool information you want on dashboards of some sort of other? I know I’m missing the all important personal non worky dashboard for Facebook, Picassa, Flickr and other news feeds.. but I’m at work – I get distracted easily enough as it is without all that!

How many dashboards do you have? What’s on them?

Next up is home tabs..

Ste Daniels

Live Chat with Learning Services

Over the last couple of months we’ve been working with colleagues in Learning Services to roll out a “live chat” service allowing students to ask helpdesk staff questions online.

Here’s what it looks like for the student:

Live Chat web client

And a sneak peak of what the staff interface looks like:

Live Chat agent client

It makes use of an XMPP/Jabber server called Openfire with a plugin called Fastpath that talks to the Spark client installed on staff machines. Fastpath provides a web interface that can be embedded into the Learning Services website.

The service is currently a trial running 11am – 3pm so go along and take a look.

ERROR 2013 (HY000): Lost connection to MySQL server during query

If you’ve just set up a new mysqld service and your getting the above error when trying to connect over TCP (even when tunnelling in over SSH), don’t fret. The answer lies in /etc/hosts.allow. You need to add in a line similar to this:

mysqld: 192.168.0.123

This foxed me a while ago and I didn’t get round to fixing it as it wasn’t yet mission critical, however it also stopped us dead in our tracks yesterday. Thank fully to Neil in Core Services who had a moment of clarity we’re now back in business.

UPDATE:

Now I know the problem, a little more simpler Google querying led me here a 2004 post on MySQL’s access denied troubleshooting page which mentions that the cause of this is mysqld being compiled with tcp-wrapper support.

Your Wiki!


In an earlier post on our wiki I mentioned that we use Confluence from Atlassian this company has a good and steady release cycle. Currently we’re couple of versions behind the latest, but hopefully that’ll soon be addressed by a move to a new much faster server!

Some of the fixes and new features that we’ll get when we upgrade are:

  • The Widget Connector – a quick an easy way to embed content from Youtube, Flickr, etc etc.
  • Various fixes and upgrades to the Rich Text Editor
  • The Macro Browser – this is an awesome new tool that is part of the RTE that allows you to browse for useful macro’s to add features to your confluence pages in a quick and easy way
  • Various performance issues have been solved
  • The Confluence PDF export has been drastically improved, especially that you can provide a PDF CSS stylesheet
  • Office 2007 files are now fully supported, searchable and embeddable in the latest version of Confluence which is just great!

Is the wiki being used?

We’ve had over 20,000 page views in the past month and we still haven’t fully launched the system to the university at whole! That being said, the Faculty of Health whom I work for have been using it extensively over the past year at least.

A quick breakdown:

graph

Currently we’ve got about four and a half thousand pages in the wiki, with about sixteen thousand versions of these pages. That averages out to about four and a half versions of each page. There are also almost ten thousand documents attached to pages on the wiki.. Good work on editing people!

A load of “Gobbledigook” from an online form

You have Spam!

Web content editors, designers and developers have all worked hard to make their website interesting, attractive and functional.

A lot of time and money is spent promoting the website. People find the website talk about it and link to it from their website, blog, wiki, bulletin board ect.

Search engines then trawl through the internet looking for links and keywords (among other things). The more links the search engine finds the more interesting the target website must be (all these people linking to it, it must be good)

The search engine goes away tots up all the scores. The one with the most incoming links is the winner. They will be at the top of the search engine ranking for that month (Its not really that simple but I think this is basically what the spammers tell their clients).

The Gobbledigook you receive from the form submission always contains links to websites. The spammer is not trying to get you to click the link. Spammer wanted a link published on a website by filling in a form that would update the blog, wiki ect. Spammer is trying to get as many links as possible pointing at the clients website, increasing the site’s search engine ranking. The results can then lead to the site being listed ahead of other sites for certain searches, increasing the number of potential visitors and paying customers.

How is it done?

A computer programme is used this searches for publicly accessible forms. Once a form is found it adds content into all text fields, a non existent email address into the email field and HTML containing a link into the text area field usually comment, content or message field.

All websites that accept content via a form are at risk of receiving spam via their forms.

Solutions

Disallowing multiple consecutive submissions
Spammers often reply to their own comments. Checking that the users IP address is not replying to a user of the same IP address would help reduce the spam flooding our in boxes.
This however proves problematic when multiple users, behind the same proxy, wish to submit the same form which is quite often the case here.

Blocking by keyword
Spammers have to use relevant and readable keywords so the search engines can index them effectively
Spam could be reduced by blocking the keywords they use simply banning names of casino games, popular pharmaceuticals and certain body enhancements.

Drawback the list could be quite extensive and would have to be maintained.

CAPTCHA
Is a method used to display an automatically generated image of a combination of numbers and letters. The user then enters the letters in to a text field to validate the form.
A computer programme can not read the image and the form will not validate.

Drawbacks sometimes difficult to read and the form needs to be refreshed or submitted several times before you get a readable image.
This system can prove difficult or impossible for the visually impaired who rely on screen readers. Providing an audio version of the characters can resolve this.

CSS
Use CSS to hide a text field. A programme will find the field enter data our validation checks the field if it contains data the submit fails.

Drawback if a screen reader is used it will find the form filed and ask for data the form will then fail validation.

Distributed Solutions
Originally developed for use on blogs but now most form data can be submitted to one of the services.
When a user submits a form the content is sent to one of the services. The content is then filtered. The service looks for links and keywords it also compares the content against a database of known spam content already submitted. The content is then given a score and sent back to your server. The server then accepts,flags or rejects the content based on the values you set.
Akismet, Defensio, Mollom are some of the web based distributed services.

Drawback Valid users can be blocked. If a user is wrongly flagged as being a spammer it can be difficult for that user to post data to websites using the same service.

Video killed the radio star

If you’ve seen the homepage of the Edge Hill website since the new design went live you’ll see something we’ve not done before – embedded video featured predominantly on the site. Of course we’ve had video on the site for ages – we’ve been linking to a Windows Media streaming server for a several years and more recently we’ve been converting video to Flash so it can be embedded in pages (on the Careers website for example). The user experience has been mixed – availability of broadband wasn’t universal, plugin support was often sketchy and the process of getting video from tape to web complex.

That’s all changing though. The BBC iPlayer has brought online video to the masses. No longer is video a novelty, it’s expected as part of the whole website package and our job is to meet those requirements. So we’ve invested in new systems to create and manage video throughout the process from capture to encoding and streaming. The media development team have acquired a Tricaster box, currently located in the control room in the Faculty of Health, which allows them to do live mixing and a whole load of other things. IT Services (or should that be Steve Daniels) have installed an eStream system to encode and store video.

The first time you might have seen these used in anger is for the Graduation ceremonies last month. There we (Media Development and Web Services) successfully mixed the ceremony and streamed live video across the campus and onto the internet. We peaked at around 70 simultaneous connections and many more in total over the three ceremonies.

The eStream box allowed us to broadcast live video in Windows Media and Flash Video formats to ensure maximum compatibility with different systems. Since then the archive video has been available for viewing, again in both WMV and FLV formats.

As part of the new website design we wanted to allow video to be more widely available throughout the site. Corporate Marketing have been generating video specifically for the website and we needed a way of embedding this. There are a couple of aspects of the eStream system that I wasn’t particularly happy with and these were addressed specifically for the website.

Firstly we maintain our own database of videos that are used on the corporate site. Here we can store extra, website-specific information, tag videos correctly, and abstract the complexities of the eStream system – we don’t care whether video is hosted on the eStream box or elsewhere.

Secondly we use a different Flash video player. The one provided by the estream box isn’t very flexible and frankly looks a bit ugly. We’re instead using the open source FLV-Player which gives us more flexibility in how it looks and what features to offer.

The video functionality for the website isn’t just on the backend – we’re adding features on the website too. Each video has its own page which is linked to across the site, and we encourage others to link to through social bookmarking systems. For an example check out one of the TV Advert pages. On this page you’ll also see that we provide code to allow you to embed the video in your own page. Here’s what the same video looks like embedded right here:

We’re particularly happy with how this looks, especially compared to some other video sites. Here’s the same video embedded from YouTube:

It’s worth noting however that YouTube have started providing higher quality versions of some videos to view within their own site, but (currently?) only low quality versions are available for embedding.

This is just the beginning of video on our websites. Over the coming months we’ll be creating much more content – everything from students talking about courses through to the next round of inaugural lectures – and making them available even more deeply within the site.

If you think all this video really does mean the death of the radio star, fear not – we’re looking at podcasts too.