KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Utility method to quit or restart 4D's internal php interpreter
PRODUCT: 4D | VERSION: 15.1 | PLATFORM: Mac & Win
Published On: March 16, 2016

The method below can be used to either quit or restart 4D's internal php interpreter.

// Method will either restart or quit the php interpreter
// Method name: PHP_QUIT_RESTART
// $1 (int) - 0 for quit, 1 for restart
// $0 (boolean) - True if success, False if fail
C_TEXT($phpMethod)
C_LONGINT($1;$choice)
C_BOOLEAN($result)

If (Count parameters>=1)
   $choice:=$1
   $result:=False
   Case of
      :($choice=0) //quit php
      $phpMethod:="quit_4d_php"
      : ($choice=1) //relaunch php
      $phpMethod:="relaunch_4d_php"
   End case
   $result:=PHP Execute("";$phpMethod)
   $0:=$result
End if

To quit the php interpreter, run the following code:
$result:=PHP_QUIT_RESTART(0)
Note that this will fail if any php processes are running.

To restart the php interperter, run the following code:
$result:=PHP_QUIT_RESTART(1)