I don't do a huge amount of php work and I've never used bcompiler before but I'm migrating a php site to a new server and I can't get this working.
There seems to be a class compiled with bcompiler 'class.viewimage.php' - it contains bz compressed code 'BZh91AY&SY;iu...'
There is then a regular php file that is calling this class:
require('class.viewimage.php');
$my_image = NEW ViewImage ($MEDIALIB->Filestore);
When this code is run it just spits the text contents of the compiled class into the browser ('BZh91AY&SY;iu...'). It's the require line which is causing this. Seems to me like php doesn't magically know that this is compiled code.
To the best of my knowledge I've installed Bcompiler on the system as this code is no longer crashing (and it was crashing when I first did the migration):
if (!extension_loaded('bcompiler')) {
$prefix = (PHP_SHLIB_SUFFIX === 'dll') ? 'php_' : '';
dl($prefix . 'bcompiler.' . PHP_SHLIB_SUFFIX);
}
Any help appreciated.
While I've had my own troubles with PHP bcompiler, using include()
or require()
to access compiled code (compiled using bcompiler_write_file()
) on a machine with the bcompiler module installed and enabled should work.
https://www.php.net/manual/en/function.bcompiler-read.php:
Note:
Please use include or require statements to parse bytecodes, it's more portable and convenient way than using this function.
Not only are there a multitude of bugs, but versions are incompatible with one another, which is what I'm guessing is your problem.
For example, my two (incompatible) machines:
CentOS 5.5, PHP 5.2.10, Apache 2.2.3, x86_64
----
bcompiler version 0.9.3-devs
current bytecode version 0.21
can parse bytecode version 0.7, 0.9, 0.11, 0.12, 0.14,
0.18, 0.21
Mac OS X 10.6, PHP 5.3.3, Apache 2.2.15, i386
----
bcompiler version 0.9.3-devs
current bytecode version 0.22
can parse bytecode version 0.20, 0.22
I submitted it as a bug to the PECL package.