Autoloading non-included extensions

This commit is contained in:
Shoghi Cervantes Pueyo 2012-12-29 19:54:05 +01:00
parent 04c3229835
commit 2370ca6fd4
3 changed files with 6 additions and 7 deletions

View File

@ -25,7 +25,6 @@ the Free Software Foundation, either version 3 of the License, or
*/ */
require_once(dirname(__FILE__)."/config.php"); require_once(dirname(__FILE__)."/config.php");
require_once("common/functions.php"); require_once("common/functions.php");
//set_error_handler("error_handler"); //set_error_handler("error_handler");
@ -49,22 +48,22 @@ if(php_sapi_name() !== "cli"){
++$errors; ++$errors;
} }
if(!extension_loaded("sockets")){ if(!extension_loaded("sockets") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "sockets." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find Socket extension", true, true, 0); console("[ERROR] Unable to find Socket extension", true, true, 0);
++$errors; ++$errors;
} }
if(!extension_loaded("pthreads")){ if(!extension_loaded("pthreads") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "pthreads." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find pthreads extension. [https://github.com/krakjoe/pthreads]", true, true, 0); console("[ERROR] Unable to find pthreads extension. [https://github.com/krakjoe/pthreads]", true, true, 0);
++$errors; ++$errors;
} }
if(!extension_loaded("curl")){ if(!extension_loaded("curl") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "curl." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find cURL extension", true, true, 0); console("[ERROR] Unable to find cURL extension", true, true, 0);
++$errors; ++$errors;
} }
if(!extension_loaded("sqlite3")){ if(!extension_loaded("sqlite3") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "sqlite3." . PHP_SHLIB_SUFFIX) === false){
console("[ERROR] Unable to find SQLite3 extension", true, true, 0); console("[ERROR] Unable to find SQLite3 extension", true, true, 0);
++$errors; ++$errors;
} }

View File

@ -26,5 +26,5 @@ if not "%PHPOUTPUT%"=="1" (
echo [ERROR] Couldn't find PHP binary in PATH. echo [ERROR] Couldn't find PHP binary in PATH.
ping 127.0.0.1 -n 3 -w 1000>nul ping 127.0.0.1 -n 3 -w 1000>nul
) else ( ) else (
START /B /WAIT php PocketMine-MP.php START /B /WAIT php -d enable_dl=On PocketMine-MP.php
) )

View File

@ -1,2 +1,2 @@
#!/bin/bash #!/bin/bash
php PocketMine-MP.php php -d enable_dl=On PocketMine-MP.php