Is it possible to dynamically reload PHP code while script is running? -
i'm having multiplayer server that's using phpsockets, , written entirely in php.
currently, whenever i'm making changes php server-script have kill script , start on again. means users online disconnected (normally not problem because there aren't many @ moment).
now rewriting server-script use custom php classes , sorten things little bit (you don't want know how nasty looks today). today thinking: "shouldn't possible make changes php source without having restart whole script?".
for example, i'm planning on having main.php file including user.php contains class myuser , game.php contains class mygame. now let's make change user.php , "reload" server changes user.php goes effect, without disconnecting online users?
i tried find other questions answered this, closest got question: modifying running script , having reload without killing (php) , doesn't seem solve disconnection of online users.
update
my own solutions were:
- at special occations, include file external.php, can access few variables , use them it'd like. when doing this, had make sure there no errors in code whole server crash if tried accessing method did not exist.
- rewrite whole thing java, gave me possibility of adding plugin system using dynamic class reloading. works charm. bye bye php.
shouldn't possible make changes php source without having restart whole script?
[...]
i'm planning on having main.php file including user.php contains class myuser
in case, can't. classes can defined once within running script. need restart script have classes redefined.
Comments
Post a Comment