Re: Adventures in PHP/Symfony

  • From: Antti Kantee <pooka@xxxxxx>
  • To: rumpkernel-users@xxxxxxxxxxxxx
  • Date: Tue, 14 Jul 2015 12:57:45 +0000

On 14/07/15 03:44, Brian G. wrote:

I just want to document some of the issues I'm having getting up and
running with PHP and Symfony so we can all have visibility into these
things.

First lets talk about the PHP level items.

I've modified the Makefile of the rumprun-package to use these flags:

(cd build && ./configure --host=$(RUMPRUN_TOOLCHAIN_TUPLE) \
--without-iconv \
--enable-opcache=no \
--disable-libxml \
--disable-simplexml \
--disable-xmlreader \
--disable-xml \
--disable-xmlwriter \
--disable-dom \
--with-gnu-ld \
--without-pear \
--enable-cli)

--disable-shared was there for a strong reason (no shared library support in rumprun). Do you really need to remove it? If so, can you describe why in detail, preferably with pointers to code.

I also have to go inside of the PHP distribution and remove a section of
the configure file ( https://gist.github.com/c79469c3dc58358ed1e0 for a
diff) as it wants to run strcasestr tests but it is disabled when
cross-compiling (I'm not sure what we can do about this issue, does this
fix need to take place upstream or is there a way we can run the test? )

Not sure why it tests for strcasestr that way instead of just using AC_CHEKC_FUNC. The test was added with the commit message "Fixed bug #66907 Solaris 10 is missing strcasestr and needs substitute". I don't have access to a Solaris 10 machine anymore, so I can't check what the exact problem is, but at least based on that message it would seem that AC_HAVE_FUNC is enough.

The flock runtime test can be replaced with this compile-only test:

=== snip ===
#include <fcntl.h>

int
main()
{
char t[&((struct flock *)0)->l_start == 0 ? 1 : -1];
return 0;
}
=== snip ===

If that program compiles, set HAVE_FLOCK_BSD, else HAVE_FLOCK_LINUX.

Can you see if the PHP project is willing to accept those patches?

XML depends on libxml2 http://xmlsoft.org/FAQ.html which I tried to
cross-compile but I'm not familiar enough to know if I did something wrong
or failed to change the linking in PHP's makefile to use libxml2.

If you need libxml2, would you like to start by contributing a libxml2 package to rumprun-packages? That way we can independently review and verify that it works, and you'll have one less moving part on your quest.

For symfony, things are a bit interesting. It appears to expect the
existence of a filesystem it can write to. I was hopeful I could change
some of the code to simply not use it, but that isn't proving
straight-forward (it appears to be a really central dependency to a lot of
it). I'm not sure if there's an option to really support this sort of thing
on a rumpkernel. It appears I can pre-build all the files it wants to build
on-demand, but in practice it simply doesn't work that way and always fails
when attempting to write to disk.

Not sure about Symphony but some other PHP frameworks seem to write to the
filesystem to implement a cache for things like compiled templates etc... if
that is the case using tmpfs might be a good option if that is possible.

The root file system is a memory file system, though (on purpose) quite a sucky one.

/tmp is tmpfs by default, but it's limited to 1MB so that any program which is accustomed to being able to write tons of data in /tmp doesn't cause guests to run out of memory. The only way to change the size currently is to edit ta_size_max in lib/librumprun_base/rumprun.c and recompile.

It's more or less trivial to add support to mount an arbitrary sized tmpfs anywhere. The problem is, as usual, in deciding what the user interface in rumprun should look like. Maybe the -b parameter needs a re{think,vamp}?

Other related posts: