PHP-5.4 is here

Things certainly move fast on the web. Just a few weeks ago we described our PHP setup on this blog and we proudly explained that we had both PHP 5.2 and 5.3 installed on our servers. But now that blog post is obsolete because PHP 5.4 was just released!
Fortunately we’ve already installed PHP 5.4 on all of our servers, just days after it was released:

[remi@web300 ~]# php54 -v
PHP 5.4.0 (cli) (built: Mar  2 2012 06:58:40)

We’ve also added a new Static/CGI/PHP-5.4 to our control panel for the early adopters.
If you want to switch an existing PHP app to PHP-5.4 you can do so by putting this in a .htaccess file:

<FilesMatch \.php$>
    SetHandler php54-cgi
</FilesMatch>

Amongst many other improvements PHP-5.4 is faster and uses less memory and it provides a new feature called Traits which enables developers to reuse code.
More details are available in the ChangeLog.

Posted in PHP | 4 Comments

Welcoming Rails 3.2.1 and Ruby 1.9.3

As you may have noticed, a new installer has appeared in the control panel for Rails 3.2.1:

Not only does the new installer include the latest iteration of Rails, but it also sports a shiny new version of Ruby, 1.9.3. Ruby-1.9.3 is now installed on all WebFaction servers:

[demo@web310 ~]$ ruby1.9 -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]

The 1.9-series Ruby features various bug fixes and library changes you might expect from a Ruby release, but it also introduces some important language changes. For example, Ruby 1.9 introduces a new syntax for creating anonymous functions:

howdy = lambda {|name| puts "Howdy, #{name}."}  # old style
hi = -> (name) {puts "Hi, #{name}."}            # new style

Ruby 1.9 introduces some other syntax and API changes, including changes to string encoding. So check out the Ruby NEWS file for more information.

Meanwhile, Rails 3.2 isn’t missing out on the fun, bringing some handy improvements, too. Highlights include a faster development mode and faster request routing. Another useful feature of Rails 3.2 is easy query explanations. In development mode, ActiveRecord queries that take longer than one half second to finish are automatically explained. In general, a new explain method makes it easier to track down slow queries and investigate indices.

To learn more about the latest developments in Ruby, check out the complete Ruby on Rails 3.2 Release Notes document.

When you’re ready, give the new Rails installer a try. If you have any questions, join us in the Q&A Community.

Posted in Rails, Ruby | Leave a comment

Nine years already!

Nine years ago we registered python-hosting.com which later became WebFaction.
Since the beginning we focused on building solid foundations: fast and stable servers, great customer service and up-to-date software. A lot has happened in 9 years but we’re proud to say that the foundations are still there.

Things are definitely speeding up though and in the last year alone we’ve almost doubled in size and we’ve added more features in one year than in the previous several years: we extended into Europe and then Asia, we started rolling out a new control panel, we built a new server setup with an innovative neighbor-protection system, we provided two massive upgrades on our base hosting plan (first diskspace and then memory) and on our managed dedicated servers, we added a 1h account setup guarantee and we added a gazillion new tools and versions to our one-click installer and our server setup.

But most importantly we hope that we have sustainably kept our customers happy and we want to thank all of you for the nice comments on Twitter, on your websites and in support tickets.

To celebrate our 9-year birthday we are offering a $50 discount on all new signups (minimum one-year pre-payment). Existing customers can also get the discount if they buy extra plans for their account. To receive the discount just use the promo code “9YEARS” when you signup at https://www.webfaction.com/signup or mention “9YEARS” when you request an upgrade in the control panel (under Account->Upgrade/Downgrade). This code is valid until February 12th 2012 at midnight UTC.

Here is to the next 9 years!

Posted in General | 10 Comments

A Look at Our PHP Setup

In the tradition of A look at our Python setup, today’s post is all about WebFaction’s PHP setup. While some of our specialized installers get a lot of attention, we know that PHP is an important, if not glamorous, part of many web developers’ toolbox. So let’s take a closer look.

On our servers, PHP 5.2 is the default version. It’s not the newest and shiniest, but it’s hugely popular. For example, on Web310:

$ php --version
PHP 5.2.17 (cli) (built: Jan 17 2012 13:19:44) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
    with the ionCube PHP Loader v4.0.10, Copyright (c) 2002-2011, by ionCube
        Ltd., and
    with Zend Optimizer v3.3.9, Copyright (c) 1998-2009, by Zend Technologies

But we’re not ignoring PHP’s development. PHP 5.3 is also available:

$ php53 --version
PHP 5.3.9 (cli) (built: Jan 16 2012 15:27:59) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with the ionCube PHP Loader v4.0.10, Copyright (c) 2002-2011, by ionCube
        Ltd.

We’ve tried to provide a lot of the more popular and useful compilation options. For example, we’ve enabled libcurl support so you can start making HTTP requests, right out of the box:

<?php
    $c = curl_init();
    curl_setopt($c, CURLOPT_URL, "http://www.webfaction.com");
    curl_exec($c);
    curl_close($c);
?>

Here’s a complete list of the our compilation flags on a CentOS 6 (64-bit) server:

--with-libdir=lib64
--with-pdo-mysql
--with-pdo-pgsql=/usr/pgsql-9.1
--enable-bcmath
--enable-calendar
--enable-exif
--enable-ftp
--enable-mbstring
--enable-soap
--enable-zip
--with-curl
--with-kerberos
--with-freetype-dir
--with-gd
--with-gettext
--with-gmp
--with-iconv
--with-imap
--with-imap-ssl
--with-jpeg-dir
--with-ldap
--with-mcrypt
--with-mhash
--with-mysql
--with-mysqli
--with-openssl
--with-pgsql=/usr/pgsql-9.1
--with-png-dir
--with-pspell
--with-regex
--with-tidy
--with-xmlrpc
--with-xsl
--with-zlib
--enable-fastcgi
--enable-sockets
--with-libxml-dir

You can see all the details on your specific machine’s PHP setup by running php-config.

In case you missed it previously, you should also know that our PHP setup allows you to send email with PHP’s built-in mail() function. There’s no requirement to use an SMTP library to send mail (though you’re welcome to do so, if you prefer). You can send email simply, like so:

<?php
    $message = "Just testing sendmail\n";
    mail('support@webfaction.com', 'Help me', $message);
?>

Of course, PHP in isolation isn’t so useful; we can plug it into the web with our corresponding Static/CGI/PHP applications. They’re more flexible than meets the eye. By default, a Static/CGI/PHP application uses a traditional php-cgi deployment method, where each PHP script is loaded and run with each request. It’s simple, effective, and perhaps best of all, doesn’t count toward your account’s memory usage.

But if you’d like to tweak your PHP deployment method, you can choose FastCGI as an alternative. Although it consumes your account’s memory, it has better performance for some applications. To use FastCGI, create a .htaccess file in your Static/PHP/CGI application directory containing this line:

<FilesMatch \.php$>
    SetHandler php52-fcgi
</FilesMatch>

You can also replace php52-fcgi with php52-fcgi2, php52-fcgi3, through php52-fcgi6 to control the number of processes FastCGI will use to serve the site.

In addition to .htaccess, you’re free to use your own php.ini file to configure your PHP application. For example, you can use php.ini to set the maximum size of file uploads. See our existing Configuring PHP docs for all the details.

Finally, we have some Static/CGI/PHP-derived installers for popular tools, like WordPress and Drupal. Under the hood, they’re PHP applications through and through, so you can use what you’ve learned here to extend or customize those applications too.

We hope this gives you a better picture of what our PHP setup is capable of and what you can do with your account. If you have any questions, let us know in the comments or join us on the Q&A Community.

Posted in Server setup | 13 Comments

Asia, here we come!

A few months ago we started offering servers in Europe. Today we’re happy to announce that we’re now offering servers in Asia too (in Singapore to be exact).

Most hosting providers charge an extra fee for hosting in Asia but we’ve decided to charge the same price as in the US and in Europe.

If your websites’ visitors are mostly in Asia then you might want to consider putting your sites on our Singapore servers rather than our American or European servers to make your sites slightly more responsive for these visitors.

When you sign up for an account you can now choose between USA, Europe or Asia for the server location (note that the Singapore location is not available for our managed dedicated servers just yet).

If you’re an existing customer you can also go to Account->migrate in the panel and request a migration of your account to a Singapore server. You can also go to Account->Upgrade/downgrade in the panel and order an extra plan in Singapore if you want one (you can have multiple plans in multiple locations from the same account).

If you would like to compare the download speed from various server locations you can download a 30MB test file from various locations: USA, Amsterdam, Singapore.

Posted in General | 5 Comments

Our biggest holiday present yet: app memory quota increased to 256MB for everyone

Six months ago we started using much beefier servers for our shared hosting plans. We also started upgrading the hardware on our existing servers. We did that because we wanted to give you as much memory for your apps as possible without overselling the RAM and overloading the servers.

Today we’re happy to announce that our shared hosting plan has been upgraded from 80MB of app memory to 256MB! This applies not only to new customers but to all existing accounts as well. You can also buy an upgrade to 512MB for an extra $7/month*.

Keeping in mind that the memory used by the operating system, the MySql and Postgresql database servers and the frontend web server don’t count towards your app memory usage (unlike on a VPS) it should be plenty for most Django, Rails, PHP and other apps you might want to run.

If your apps outgrow 512MB of memory then you can either spread them across multiple servers or upgrade to one of our managed dedicated servers.

Here is to our biggest holiday present yet!

*The upgrade from 256MB to 512MB is only available on our newer servers (Web300 and over and all servers in Amsterdam) and the following servers: Web4, Web27, Web28, Web70, Web114, Web129, Web174, Web184, Web200 and Web213. This is because the other servers don’t have enough RAM. If you’re on another server and want 512MB of memory you can request a migration from the control panel (Account->Server migration).
Update: The list of servers where you can upgrade to 512MB is now: Web300 and over, Web4, Web27, Web28, Web70, Web114, Web129, Web174, Web182, Web200, Web208, Web209, Web210, Web211, Web213, Web216, Web217, Web218, Web223, Web224, Web225, Web226.

Posted in General | 35 Comments

WordPress 3.3 is here

WordPress 3.3 is out now and so is our new one-click installer:

This version of WordPress has many new features and refinements. One of the handiest new features is the drag-and-drop media uploader. Just drag files from your computer onto the target to upload files easily:

The dashboard has also received a considerable refresh. For example, the dashboard’s admin header and admin bar have been combined into a unified toolbar. Feature callouts help introduce new WordPress features (great for novice and expert users alike). WordPress 3.3′s dashboard also reduces the number of clicks for navigation with mouse over fly out menus:

There’s a lot more in this version of WordPress, especially for developers. Check out the video introduction and the WordPress Codex’s comprehensive changelog for all the details. When you’re ready, give the WordPress 3.3 one-click installer a try and join us in the Q&A Community if you have any questions.

Posted in WordPress | Leave a comment

Server Name Indication enabled on all servers

A few weeks ago we enabled Server Name Indication (SNI) on all of our servers.

SNI allows you to use an SSL certificate for your secure site (https) without having to buy a dedicated IP address.

It works by having the browser send the hostname as part of the initial handshake so the webserver knows which certificate to use even if multiple certificates are used on the same IP address.

Note however that while SNI is supported by most modern browser some older browsers (notably all versions of Internet Explorer on Windows XP) don’t support it. If you choose to use SNI and someone visits your secure site with a browser that doesn’t support SNI they will receive our default certificate and their browser will display a certificate-mismatch warning.

Posted in Server setup | 5 Comments

1h account activation

We’re pleased to announce that starting today we’re guaranteeing a 1h account activation time for all new signups*. This guarantee also applies to upgrade/downgrade requests from the control panel (except dedicated IP addresses). This will allow you to rapidly scale your apps up or down as you need.

* A small number of payments get flagged for manual fraud checks. In that case the 1h starts once the payment has cleared the checks. If for some reason we cannot activate the account within 1h then the first month is free.

Posted in General | 1 Comment

Fair shared hosting

Traditional shared hosting has always suffered from the “bad neighbor problem”: your site runs fine until another user on the machine decides to encode 20 video files and all of the sudden your site is very sluggish.

That problem is now history on our centos6 servers thanks to a relatively unknown feature recently added to the linux kernel: cgroups.

cgroups allow admins to define various groups and various rules for which processes should go into which groups. Each group can then be allocated various resources or resource priorities relative to other groups.

Here is how cgroups get rid of the traditional “bad neighbor problem” in shared hosting:

Cgroups

  • Imagine a CPU-intensive script called “cpu-eater”
  • Imagine that user A runs 3 instances of the script (process 1, 2 and 3) and users B and C each run one instance of that script (process 4 and 5)
  • Without cgroups each of these 5 processes gets allocated the same amount of CPU (20% each if all the CPU power is available) which means that user A gets 60% in total and user B and C get 20% each. User A is being a bad neighbor and that’s not fair to users B and C.
  • With cgroups we can configure it so that each user gets their own cgroup and all of a user’s processes go in that user’s cgroup. We then configure it so that all cgroups have the same CPU priority. This means that users A, B and C each get 33.3% of the CPU to run their “cpu-eater” scripts which is fair.

Note that cgroups keep all the CPU power available to processes who want it: if there are only two CPU-intensive processes on the machine they’ll get 50% CPU each. If there is only one CPU-intensive process on the machine it’ll get 100% CPU.

Also, this example mentions CPU usage but cgroups can do the same for disk IOs and network IOs.

We’ve been running cgroups on all of our Centos6 servers for a few months and we’ve seen great results! No longer can a single user affect all other users on the machine.

Posted in Server setup | 3 Comments