Category Archives: Blog

Blog-часть сайта

Ubuntu + Vagrant + VirtualBox + Ubuntu = Sleepless night

Because of some migration experiment, required by the project I’m working on, I’ve had interesting issue at last sleepless night with Ubuntu, Vagrant, VirtualBox and more Ubuntu.

My current host setup:

  • Ubuntu 16.04 LTS (up to date)
  • VirtualBox 5.0.24
  • Vagrant 1.8.4

The goal: migrate Vagrant + Puppet development setup from Debian 7 to Ubuntu 16.04. At least try to and get familiar with part of the issues.

Because I’m familiar with Debian and Ubuntu, and all Puppet provisioning scripts done mostly by me or my team members with my supervision – migration of Puppet provisioning went well (almost well, some small changes ant tweaks left, but nothing special).

Troubles appeared a bit later – when I’ve tried to setup project’s NPM requirements inside the box. After running npm install and after few first packages where installed “root” partition of new VM became read-only and installation process failed. That’s a strange issue – PHP dependencies, managed by Composer, went well and without any error or warning.

Installation process of NPM packages just stops and do not respond to any command. In TTY console I see: “Rejecting I/O to offline device“. In SSH console I see many errors like: “glob error { [Error: EIO: i/o error, scandir '/home/<username>/.npm/<packagename>/2.0.1/package']

Spend few hours by searching solution over internet and nothing helps:

  • Upgrading VirtualBox Guest Additions
  • Adding vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
  • Adding vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
  • Adding vb.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant-root", "1"]
  • Running npm install --no-bin-links

By the way – sometimes this ends with kernel panic.

All that time I was using ubuntu/xenial64 box version 20160705.0.0.

One of the main reasons, described on the Internet was “symlinks don’t work on VirtualBox shared folders”. But this is not the case – I perfectly know shared folders issues and I don’t use them for project’s files sync between host and guest.

So, I’ve made clean Ubuntu Xenial install from ISO on fresh created virtual machine and everything went smoothly, from OS install to NPM – everything was installed!

Same good result was with PuppetLabs box puppetlabs/ubuntu-16.04-64-puppet.

This is how just a tiny issue with base box can keep you a bit sleepless. Yes, I know, that was my choice.

Now the question – should I build own box that I trust for this project or use something from third party Vagrant boxes available on Internet?

Debian Backports

If you are new to Debian, and you require some newer software than present in “stable” version, and ready to take the risks – you can use Debian Backports repository. To get a bit more familiar with this official Debian repository you can start from reading “What are Debian Backports?“. Just read carefully, understand the risks and test before going to production.

It’s O.K. It’s a tiny change!

It’s O.K. It’s an appearance update and WordPress upgrade.

It takes a year to write here something, at least so short as this post. Most of blog-post become irrelevant in matter of weeks – while you find time to write them and distil the idea, so they die in agony somewhere in Trash or Google Drive/Docs. Oh, and we have Micro-blogging and Social Networks around as time killers…

It takes four years ( damn, time goes fast o_O ) to find time and update WordPress on this blog. Glad WordPress is still alive and became better with version 3.x It was never so easy to make order in this chaos.

I’ve removed some old texts in Russian about Apache and PHP installs, and something else – irrelevant old stuff.

Now I need cool photo for the website’s header (I don’t have such even on my Facebook :-D ). Hope to find one until the end of the year ;-)

Awaiting for the HipHop for PHP

Facebook Developers created a great hype in PHP World around their new Open Source project called HipHop for PHP only with one blog post: HipHop for PHP: Move Fast. I’m waiting for HipHop for PHP to become public available to try this great feature on few projects I work on.

Facebook Developers where very kind to mention some Open Source competitors that already publicly available for try and use. Two of them I’m interested in are: Roadsend and phc.

While waiting for the HipHop for PHP I decided to see how and what Roadsend and phc can do, what limitations they have and what features they provide. It wasn’t full-scale tests, just some quick tests.

Neither Roadsend nor phc were found in Ubuntu software repository, so I compiled them from the source. I was surprised by clear installation instructions provided by both PHP compilers. There was no trouble to compile and install Roadsend and phc, except dependencies that were easily compiled to (I just hate dependencies). Well, I should mention that phc requires much more time to compile event without counting PHP compilation time comparing to Roadsend.

First “Hello World!” PHP script was compiled without any trouble. Script that gathers 100 records from MySQL database compiled well also. I haven’t tried anything complicated yet, but I don’t need it for now. I want just to see what and how they do.

Roadsend

It is a stand alone implementation of PHP that converts PHP code to executable, FastCGI application or stand alone server.

What I liked in Roadsend is that you can choose what to compile: FastCGI application or Stand Alone applications (using MicroServer, but I haven’t tried this) or executable. I like FastCGI – it is patible with many httpd servers including my favorite NGINX. FastCGI script, fetching 100 rows from MySQL database worked with a charm on NGINX.

One more thing I liked in Roadsend – you can compile your code to libraries and reuse that compiled libraries in next your applications. Just don’t forgot that it will work only with Roadsend implementation of PHP.

Another benefit of Roadsend is that they provide ready to use (with Quick and Dirty Guide) scripts to create .deb and .rpm packages and a way to compile it on Windows. Such way would make deployment much easier.

What I don’t liked in Roadsend that it is a stand alone implementation of PHP and you are limited to extensions and features that Roadsend provide. Moreover, they provide only few popular extensions. I think somewhere there are instructions how to port/embed/bind other PHP extensions to Roadsend, but I haven’t found them.

Another disturbing thing is that you can’t control number of FastCGI processes like you do in PHP-FPM or with standard PHP in FastCGI. Nothing is mentioned in manual about that.

If you are limited to PHP Standard Library, MySQL or SQLite, PCRE, XML, CURL – Roadsend may be very useful for you.

phc

phc is a PHP compiler that converts PHP code to executable or PHP extension.

I like the idea of Web application as PHP extension but the main issue in my point of view that compiled PHP extension is called by __MAIN__() function. So, without small hacking of extension C code you can’t have two Web applications as PHP extensions on same server. If they would change function name from __MAIN__() to something more usable like phc_extansionname() – it would be easier.

Another thing I liked in phc is that they use embedded PHP for compilation. So it should be compatible with all PHP extensions.

I like the way they do it in phc: PHP code converted to C code that uses native internal PHP functions and types.

What I missed is the way to create a PHP extension from any function library written in PHP. I think it would be a great benefit for that compiler.

If you like the idea to have your entire website as PHP extension – you should try this solution.

Other solutions

Oh, there are two more solutions: JAVA based Quercus and .NET Phalanger, but I haven’t tried them yet.

After reviewing and trying Roadsend and phc (I’ve read information about Quercus earlier) now, at least, I know what and how do compilation competitors of HipHop for PHP.

But what Facebook will bring to public after two years of development? Which features? Which limitations? Will HipHop for PHP require many changes of existing projects that I work on?