Hi there,

i have following problem:

Assume we have a "cron.php" which is called every hour by a cron job. This cron.php should then be used to execute other php-scripts "script1.php", "script2.php".

For a pitty our server has Safe-Mode activated so we arent able to shell_exec / exec those files. So we came up with the idea: Lets include those scripts using include(). But this lead us to another problem: Namespace conflicts (our server is running php 2.7.2) especially with classes and constants.

Example:
<<script1.php>>
<?php
class A {
  public function test(){ echo "im class A at script 1"; }
}
?>

<<script2.php>>
<?php
class A {
  public function test(){ echo "im class A at script 2"; }
}
?>

<<cron.php>>
<?php

include('./script1.php');
include('./script2.php');
?>


Cron.php will raise a "cannot redefine class A" error.

So my idea is to continously rename every occurence of class names and constants in the scripts by adding a suffix (ie. class A_123 and class A_234). Do you have an idea how to implement this during the deployment step?

Sincerly yours

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to