Archive for category Servers

Switching MySQL for MariaDB on Ubuntu.

MariaDB offers quite a few improvements over MySQL, mainly in the storage engines it provides. Firstly, the Maria engine is a crash safe version of MyISAM which in the future will also support transactions. Secondly, the XtraDB engine is an enhanced version of Innodb which can give considerable speed improvements over the standard Innodb engine. There are many other features and improvements over the standard MySQL distribution, move info on the differences can be found here: http://askmonty.org/wiki/MariaDB_versus_MySQL

The easiest way to install MariaDB is to add one of the repositories, I’ve used OurDelta:

wget -O- http://ourdelta.org/deb/ourdelta.gpg | sudo apt-key add -
sudo wget http://ourdelta.org/deb/sources/lucid-mariadb-ourdelta.list -O /etc/apt/sources.list.d/ourdelta.list

Then install MariaDB:

sudo apt-get install mariadb-server-5.1

This should install MariaDB without any problems, it should also replace MySQL if you already installed it:

# apt-get install mariadb-server-5.1
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
libmariadbclient16 libmysqlclient16 mariadb-client-5.1
mariadb-client-core-5.1 mariadb-server-core-5.1 mysql-common
Suggested packages:
tinyca mailx mariadb-test
The following packages will be REMOVED
libmysqlclient-dev libmysqlclient16-dev mysql-client mysql-client-5.1
mysql-client-core-5.1 mysql-server-5.1 mysql-server-core-5.1
The following NEW packages will be installed
libmariadbclient16 mariadb-client-5.1 mariadb-client-core-5.1
mariadb-server-5.1 mariadb-server-core-5.1
The following packages will be upgraded:
libmysqlclient16 mysql-common
2 upgraded, 5 newly installed, 7 to remove and 8 not upgraded.

If you are upgrading from MySQL, you will probably be prompted to overwrite the my.cnf and for a new root password. I generally choose Y to overwrite and enter my existing root password to avoid issue.

You can also follow my previous post to upgrade the client library used by PHP, rather than installing the MySQL dev package, the Maria equivalent should be used:

sudo apt-get install libmariadbclient16-dev
  • Share/Bookmark

Update Zend Server MySQL extensions

As the MySQL extensions with Zend Server are out of date, I decided to update them as it’s pretty simple to do.

Install the source package:

sudo apt-get install php-5.2-source-zend-server

or

sudo apt-get install php-5.3-source-zend-server

Install the MySQL client dev package:

sudo apt-get install libmysqlclient16-dev

Install autoconf:

sudo apt-get install autoconf

From this point onwards I ran as root as saves time having to sudo everything, I have also created symlinks for the binaries in /usr/local/zend/bin to /usr/local (php, phpize, php-config, pear, pecl etc)

Change to the extensions directory of the source you just installed:

cd /usr/local/zend/share/php-source/php-5.3.2/

There are 3 extensions that need to be recompiled mysql, mysqli and pdo_mysql, the following procedure is the same for all 3:

cd mysql
./configure
make
cp modules/mysql.so /usr/local/zend/lib/php_extensions/

Finally restart Zend Server and all the MySQL extensions will be using the latest libraries.

  • Share/Bookmark

Zend Server on Ubuntu Lucid has dependency problems

When trying to install Zend Server on Lucid you will be met with the following dependency problems:

The following packages have unmet dependencies:
php-5.2-mysql-zend-server: Depends: libmysqlclient15off (>= 5.0.27-1) which is a virtual package.
php-5.2-pdo-mysql-zend-server: Depends: libmysqlclient15off (>= 5.0.27-1) which is a virtual package.
php-5.2-mysqli-zend-server: Depends: libmysqlclient15off (>= 5.0.27-1) which is a virtual package.

Along with the rather unsatisfactory resolution:

The following actions will resolve these dependencies:
Keep the following packages at their current version:
help-zend-server-ce [Not Installed]
php-5.2-common-extensions-zend-server-ce [Not Installed]
php-5.2-mysql-zend-server [Not Installed]
php-5.2-mysqli-zend-server [Not Installed]
php-5.2-pdo-mysql-zend-server [Not Installed]
zend-server-ce-php-5.2 [Not Installed]

The reason for this error is that the Zend MySQL packages are built against MySQL 5.0 (despite the fact 5.1 has been GA for over a year now).

Ubuntu have removed MySQL 5.0 in Lucid, but the package from Karmic is usable and available here: http://ns2.canonical.com/pt/karmic/libmysqlclient15off

Simply install this and Zend Server will install nicely.

  • Share/Bookmark

Ubuntu 10.04 Server, so far so good!

I upgraded one of my Karmic servers to Ubuntu 10.04 RC the other day.

The last upgrade from Jaunty to Karmic was a rather traumatic process, but thankfully this time round all went smoothly. Not really any overly noticeable changes this time round other than a few more things have moved into upstart (MySQL for example) and when I boot via KVM the new Plymouth boot screen is present, although not sure why this is even included in a server release.

It’s about as updated a LAMP setup as is possible including Apache 2.2.14, MySQL 5.1.41 and especially pleased they put in PHP 5.3.2 after the code freeze. On this server I’m actually running Zend Server CE (which already had PHP 5.3.2) as Zend are quicker to push out the updates, but on others I will stick with the default Ubuntu release.

What else can be said about a server OS? Well, it just works :)

  • Share/Bookmark

Ubuntu 10.04 – Looks like it will ship with PHP 5.3

I took a look on Launchpad today to see if there was any indication as to which version of PHP Ubuntu had decided to ship with the next release. As it’s an LTS release there is always the possibility that they may go for the slightly more stable options than the slightly more experimental options as they will have to support this edition for the next 3 years.

It appears from a package search that 2 days ago PHP 5.3.1 packages were added to Lucid. It’s quite a big step, and will be interesting if they also include a 5.2.x release along side it as so many applications are not ready for 5.3 yet.

More information can be found on Launchpad:


  • Share/Bookmark

Zend Server 5.0 Upgrade Fix

As mentioned in my previous post about Zend Server 5.0 upgrade, the GUI images are missing following the upgrade.

It turns out that for some reason Apt doesn’t properly upgrade the Zend Server package itself, to fix this I ran the repository installer script again on all effected machines.

$ sudo ./install_zs.sh 5.3 ce

Running this script will preform the following:
* Configure your package manager to use Zend Server repository
* Install Zend Server on your system using your package manager

Hit ENTER to install Zend Server, or Ctrl+C to abort now.

–2010-03-01 22:53:18– http://repos.zend.com/deb/zend.key
Resolving repos.zend.com… 93.188.128.18
Connecting to repos.zend.com|93.188.128.18|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 1673 (1.6K) [text/plain]
Saving to: `STDOUT’

100%[==============================================================================================================================>] 1,673 –.-K/s in 0s

2010-03-01 22:53:19 (57.4 MB/s) – `-’ saved [1673/1673]

OK
Writing extended state information… Done
Hit http://gb.archive.ubuntu.com karmic Release.gpg
Get:1 http://gb.archive.ubuntu.com karmic/main Translation-en_GB [63.7kB]
Hit http://security.ubuntu.com karmic-security Release.gpg
Ign http://security.ubuntu.com karmic-security/main Translation-en_GB
Get:2 http://gb.archive.ubuntu.com karmic/restricted Translation-en_GB [3,402B]
Get:3 http://gb.archive.ubuntu.com karmic/universe Translation-en_GB [33.2kB]
Get:4 http://gb.archive.ubuntu.com karmic/multiverse Translation-en_GB [43.8kB]
Get:5 http://gb.archive.ubuntu.com karmic-updates Release.gpg [189B]
Ign http://gb.archive.ubuntu.com karmic-updates/main Translation-en_GB
Ign http://gb.archive.ubuntu.com karmic-updates/restricted Translation-en_GB
Ign http://gb.archive.ubuntu.com karmic-updates/universe Translation-en_GB
Ign http://gb.archive.ubuntu.com karmic-updates/multiverse Translation-en_GB
Ign http://security.ubuntu.com karmic-security/restricted Translation-en_GB
Ign http://security.ubuntu.com karmic-security/universe Translation-en_GB
Ign http://security.ubuntu.com karmic-security/multiverse Translation-en_GB
Hit http://security.ubuntu.com karmic-security Release
Hit http://gb.archive.ubuntu.com karmic Release
Get:6 http://gb.archive.ubuntu.com karmic-updates Release [44.1kB]
Hit http://repos.zend.com server Release.gpg
Hit http://security.ubuntu.com karmic-security/main Packages
Hit http://security.ubuntu.com karmic-security/restricted Packages
Hit http://security.ubuntu.com karmic-security/main Sources
Hit http://security.ubuntu.com karmic-security/restricted Sources
Hit http://security.ubuntu.com karmic-security/universe Packages
Hit http://security.ubuntu.com karmic-security/universe Sources
Hit http://security.ubuntu.com karmic-security/multiverse Packages
Hit http://security.ubuntu.com karmic-security/multiverse Sources
Hit http://gb.archive.ubuntu.com karmic/main Packages
Hit http://gb.archive.ubuntu.com karmic/restricted Packages
Hit http://gb.archive.ubuntu.com karmic/main Sources
Hit http://gb.archive.ubuntu.com karmic/restricted Sources
Hit http://gb.archive.ubuntu.com karmic/universe Packages
Hit http://gb.archive.ubuntu.com karmic/universe Sources
Hit http://gb.archive.ubuntu.com karmic/multiverse Packages
Hit http://gb.archive.ubuntu.com karmic/multiverse Sources
Get:7 http://gb.archive.ubuntu.com karmic-updates/main Packages [182kB]
Get:8 http://gb.archive.ubuntu.com karmic-updates/restricted Packages [14B]
Get:9 http://gb.archive.ubuntu.com karmic-updates/main Sources [54.4kB]
Get:10 http://gb.archive.ubuntu.com karmic-updates/restricted Sources [14B]
Get:11 http://gb.archive.ubuntu.com karmic-updates/universe Packages [108kB]
Get:12 http://gb.archive.ubuntu.com karmic-updates/universe Sources [26.3kB]
Get:13 http://gb.archive.ubuntu.com karmic-updates/multiverse Packages [6,844B]
Get:14 http://gb.archive.ubuntu.com karmic-updates/multiverse Sources [3,820B]
Ign http://repos.zend.com server/non-free Translation-en_GB
Hit http://repos.zend.com server-testing Release.gpg
Ign http://repos.zend.com server-testing/non-free Translation-en_GB
Hit http://repos.zend.com server Release
Hit http://repos.zend.com server-testing Release
Ign http://repos.zend.com server/non-free Packages
Ign http://repos.zend.com server-testing/non-free Packages
Ign http://repos.zend.com server/non-free Packages
Ign http://repos.zend.com server-testing/non-free Packages
Hit http://repos.zend.com server/non-free Packages
Hit http://repos.zend.com server-testing/non-free Packages
Fetched 569kB in 3s (188kB/s)
Reading package lists… Done

Reading package lists… Done
Building dependency tree
Reading state information… Done
Reading extended state information
Initialising package states… Done
The following NEW packages will be installed:
help-zend-server-ce{a}
The following packages will be REMOVED:
libcurl3{u} php-5.3-code-tracing-zend-server{u} php-5.3-pecl-http-zend-server{u}
The following packages will be upgraded:
zend-server-ce-php-5.3
1 packages upgraded, 1 newly installed, 3 to remove and 1 not upgraded.
Need to get 3,668kB of archives. After unpacking 13.3MB will be used.
Do you want to continue? [Y/n/?] y
Writing extended state information… Done
Get:1 http://repos.zend.com server/non-free help-zend-server-ce 5.0.0+b6 [3,666kB]
Get:2 http://repos.zend.com server/non-free zend-server-ce-php-5.3 5.0.0+b2 [1,388B]
Fetched 3,668kB in 0s (7,644kB/s)
(Reading database … 78500 files and directories currently installed.)
Removing php-5.3-pecl-http-zend-server …
Removing libcurl3 …
Removing php-5.3-code-tracing-zend-server …
Processing triggers for libc-bin …
ldconfig deferred processing now taking place
Selecting previously deselected package help-zend-server-ce.
(Reading database … 78474 files and directories currently installed.)
Unpacking help-zend-server-ce (from …/help-zend-server-ce_5.0.0+b6_all.deb) …
Preparing to replace zend-server-ce-php-5.3 4.0.5+b5 (using …/zend-server-ce-php-5.3_5.0.0+b2_all.deb) …
Stopping Zend Server 5.0 ..

Stopping Zend Server GUI [Lighttpd] [OK]

Zend Server stopped.
Unpacking replacement zend-server-ce-php-5.3 …
* Starting web server apache2 [ OK ]
Setting up help-zend-server-ce (5.0.0+b6) …
Setting up zend-server-ce-php-5.3 (5.0.0+b2) …
* Stopping web server apache2 … waiting [ OK ]
Starting Zend Server 5.0 ..

spawn-fcgi: child spawned successfully: PID: 4704
Starting Zend Server GUI [Lighttpd] [OK]
[ 01.03.2010 22:54:20 SYSTEM] watchdog for lighttpd is running.
[ 01.03.2010 22:54:20 SYSTEM] lighttpd is running.

Zend Server started…

Reading package lists… Done
Building dependency tree
Reading state information… Done
Reading extended state information
Initialising package states… Done
Writing extended state information… Done

Current status: 1 update [-1].
Zend Server was successfully installed.

After this everything worked as it should!

  • Share/Bookmark

New ffmpeg builds projects page

I’ve added a new projects page for my ffmpeg builds for PHP 5.3.
The new page also includes a version compiled against PHP 5.3.1 from today’s new Zend Server release.

The new page can be found here.

  • Share/Bookmark

Zend Server 5 / PHP 5.3.1 released

Today Zend announced the release of Zend Server 5.0, which also includes PHP 5.3.1.

I have performed an apt-get update/upgrade on my servers which worked without issue, however the GUI seams to be a bit buggy following the upgrade. Firstly it looks like some of the styles and images are wrong/missing and secondly the restart button doesn’t seam to work.

For full downloads visit the Zend website:


  • Share/Bookmark

PHP 5.3 on Ubuntu – Configuration

I’ve been testing PHP 5.3 on various Ubuntu machines for the last few months (since around the time of my first post). I’m now running it on a production server for 1 site.

I noticed I have been getting a lot of hits on my previous post, mainly from others looking for ways to install PHP 5.3 on Ubuntu so I thought it was about time for a follow up.

I’m using PHP 5.3.0 as this is the latest release for Zend Server, the only 5.3.1 release I’m aware of is the DotDeb packages. I try to stay clear of DotDeb, mainly because the packages are built for Debian which often causes issues and conflicts. (Ubuntu is based on Debian unstable so can potentially have a completely different version of every package than the Debian stable branch, as well as changes/tweaks/updates from the Ubuntu team.)

Here are the tweaks I have made to enable PHP to run smoothly, it’s generally quicker to use the Zend web GUI, but these changes can also be done by editing php.ini or adding/removing symbolic links to extensions:

Config changes:

  • Set the default timezone. This seams to be a requirement for PHP 5.3 to have the local timezone set, otherwise we are spammed with about 20 deprecated message when PHP starts. There are a number of ways to do this, the easiest of which is to set the date.timezone config parameter.
  • Set the full path to sendmail. The PHP mail() command will fail unless this is done, this is due to a bug in either PHP or Zend Server (which of them, I’m not sure). Set the sendmail_path config parameter to do this.
  • [Optional] By default the maximum file size you can upload is around 8Mb, if you are likely be using larger files than this, video uploads for example, this change becomes essential. There are 2 options for this setting, both post_max_size and upload_max_filesize should be set.
  • [Optional] By default session timeouts are very short (only about 20 mins), I find it’s usualy a good idea to make it longer.

Extension changes:

  • By default Zend Server comes with tonnes of database extensions, MySQL, PostGreSQL, MSSQL, ODBC, OCI8, SQLite plus PDO versions of most of the above. There is no point having extensions in there we don’t need, pick the extension(s) you need and disable the rest.
  • Disable pcntl on web server environments, as it is apparently not supposed to be used in this way.

This is really all is need to get things up and running, shouldn’t take more than a minute to do.

  • Share/Bookmark

Which RAID is best?

There are many sites with various RAID comparisons on and many more making various claims as to which RAID type is the best for various purposes/fastest/etc.

The 2.5Tb storage partition on my Xen box decided to pack up recently (or at least Xen decided it no longer wanted to read the partition) so after backing up the data decided to run some tests.

Drives: 4x Western Digital RE 1Tb

RAID 5:

This was the original configuration of the array, despite having fast drives in my desktop and 1Gbit network the read speeds were slower than expected (around 35Mb/sec).

The hdparm results were inconsistent:

Timing cached reads: 10118 MB in 2.00 seconds = 5064.59 MB/sec
Timing buffered disk reads: 224 MB in 3.02 seconds = 74.24 MB/sec

Timing cached reads: 10020 MB in 2.00 seconds = 5016.71 MB/sec
Timing buffered disk reads: 148 MB in 3.03 seconds = 48.83 MB/sec

Timing cached reads: 10126 MB in 2.00 seconds = 5068.86 MB/sec
Timing buffered disk reads: 200 MB in 3.03 seconds = 65.94 MB/sec

Timing cached reads: 10086 MB in 2.00 seconds = 5049.90 MB/sec
Timing buffered disk reads: 234 MB in 3.02 seconds = 77.55 MB/sec

Timing cached reads: 10042 MB in 2.00 seconds = 5027.45 MB/sec
Timing buffered disk reads: 210 MB in 3.01 seconds = 69.80 MB/sec

Average over the 5 tests: 67.27 Mb/sec

RAID 10:

As an alternative I switched the array to RAID 10, the downside of this configuration is that there is 1Tb less space than RAID 5.

Timing cached reads: 10170 MB in 2.00 seconds = 5091.34 MB/sec
Timing buffered disk reads: 320 MB in 3.01 seconds = 106.46 MB/sec

Timing cached reads: 10094 MB in 2.00 seconds = 5052.71 MB/sec
Timing buffered disk reads: 316 MB in 3.02 seconds = 104.59 MB/sec

Timing cached reads: 10072 MB in 2.00 seconds = 5041.96 MB/sec
Timing buffered disk reads: 314 MB in 3.01 seconds = 104.29 MB/sec

RAID 10 results are much more consistent.
Average over the 3 tests: 105.11 Mb/sec

RAID 6:

Another configuration offering 2 disk redundancy.

Timing cached reads: 10172 MB in 2.00 seconds = 5091.87 MB/sec
Timing buffered disk reads: 202 MB in 3.01 seconds = 67.06 MB/sec

Timing cached reads: 10052 MB in 2.00 seconds = 5031.76 MB/sec
Timing buffered disk reads: 202 MB in 3.01 seconds = 67.18 MB/sec

Timing cached reads: 10102 MB in 2.00 seconds = 5057.17 MB/sec
Timing buffered disk reads: 206 MB in 3.00 seconds = 68.59 MB/sec

RAID 6 results are also fairly consistent.
Average over the 3 tests: 67.61 Mb/sec

It seams that with this configuration that RAID 5/6 perform at roughly the same speed, however RAID 10 seams to win out on the speed test with over 50% improvement over RAID 5/6.

  • Share/Bookmark