Bridge Ruby and PHP (in a CMS)?

I have not found any CMS-like framework in Ruby, and may have to fall
back on to something written in PHP.

Is it possible to have Ruby and PHP talk easily to each other on the
server side, if I have mod-ruby and mod-php both installed?

Any pointers, or alternative suggestions, appreciated.

possibly, this could help?
http://raa.ruby-lang.org/list.rhtml?name=pruby
pRuby is a glue code between PHP and Ruby

···

il 15 Jun 2003 15:54:09 -0700, itsme213@hotmail.com (you CAN teach an old dog …) ha scritto::

I have not found any CMS-like framework in Ruby, and may have to fall
back on to something written in PHP.

Is it possible to have Ruby and PHP talk easily to each other on the
server side, if I have mod-ruby and mod-php both installed?

Any pointers, or alternative suggestions, appreciated.

http://www.aagh.net/projects/ruby-php-serialize may be helpful.

You can do things like:

class Meh
attr_accessor :wah,:feh
def to_assoc
[[:wah,@wah],[:feh,@feh]]
end
end

bah = Meh.new
bah.wah = “Sigh”
bah.feh = 5.4321
Foo = Struct.new(:foo,:bar,:wibble)
File.open(‘cache’, ‘w’) do |f|
PHP.serialize(Foo.new(
[‘meh’, ‘moo’, 1234, false, true],
{‘foo’ => ‘bar’, 1 => [‘a’, ‘b’, ‘c’]},
bah))
end

And on the PHP side:

class Foo {}
class Meh {}

if ($fp = fopen(“cache”, “r+”))
{
$foo = unserialize(fread($fp, 65535));
rewind($fp);

    print_r($foo);
    $foo->wibble->wah = "PHP suxx! Ruby rulez!!!1!1!1111111";
    fwrite($fp, serialize($foo));
    fclose($fp);

}

And back on Ruby:

File.open(“cache”) do |f|
p PHP.unserialize(f.read)
end

I suppose it might come in handy :slight_smile:

···

I have not found any CMS-like framework in Ruby, and may have to fall
back on to something written in PHP.

Is it possible to have Ruby and PHP talk easily to each other on the
server side, if I have mod-ruby and mod-php both installed?

Any pointers, or alternative suggestions, appreciated.


Thomas ‘Freaky’ Hurst - freaky@aagh.net - http://www.aagh.net/