I've a problem with a simple chdir and require.
From a first file : web/index_cluster.php
I'm trying to load a second one : ezpublish_legacy/index_cluster.php
My required file do not load but I've no clue why...
Here's my config.
- PHP 5.4.16
- Upgrading from eZ Publish 4.7 to eZ Pubslih 5.90.0alpa1 (based on SF2)
- Red Hat Enterprise Linux Server release 6.4 (Santiago)
There is nothing on ezpublish log and a Allowed memory size in apache
PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 240 bytes) in /path/to/my/www/web/index_cluster.php on line 11
Here's my (simplified) tree
www
`-- ezpublish_legacy
|-- index_cluster.php
`-- web
|-- index_cluster.php
Here's the original code
$legacyRoot = '/path/to/my/www/ezpublish_legacy';
chdir( $legacyRoot );
require 'index_cluster.php';
And here's my fix
$legacyRoot = '/path/to/my/www/ezpublish_legacy';
chdir( $legacyRoot );
require '/path/to/my/www/ezpublish_legacy/index_cluster.php';
I've tried everything I could think of :
$legacyRoot = '/path/to/my/www/ezpublish_legacy';
require $legacyRoot.'/index_cluster.php';
=> Working
$legacyRoot = '/path/to/my/www/ezpublish_legacy';
echo getcwd() . "\n";
chdir( $legacyRoot );
echo getcwd() . "\n";
die()
require 'index_cluster.php';
=> exactly what I'm expecting
/path/to/my/www/web
/path/to/my/www/ezpublish_legacy
Loading with absolute path and checking current directory on loaded file is giving the expected result
web/index_cluster.php
require '/path/to/my/www/ezpublish_legacy/index_cluster.php';
ezpublish_legacy/index_cluster.php
echo getcwd() . "\n";
die();
result in (what I'm expecting)
/path/to/my/www/web
web/index_cluster.php
$legacyRoot = '/path/to/my/www/ezpublish_legacy';
chdir( $legacyRoot );
require '/path/to/my/www/ezpublish_legacy/index_cluster.php';
ezpublish_legacy/index_cluster.php
echo getcwd() . "\n";
die();
result in (what I'm expecting)
/path/to/my/www/ezpublish_legacy
Update : I've tried something new :
require "/index_cluster.php" => instant fail
PHP Warning: require(/index_cluster.php): failed to open stream: No such file or directory in /path/to/my/www/web/index_cluster.php on line 11
require "index_cluster.php" => trying loading for 10 seconds then fail
PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 240 bytes) in /path/to/my/www/web/index_cluster.php on line 11