From 2370ca6fd4750904386741f9b8592123d3e28464 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Sat, 29 Dec 2012 19:54:05 +0100 Subject: [PATCH] Autoloading non-included extensions --- src/common/dependencies.php | 9 ++++----- start.cmd | 2 +- start.sh | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/common/dependencies.php b/src/common/dependencies.php index 5c0408aa1..58d6a3d8e 100644 --- a/src/common/dependencies.php +++ b/src/common/dependencies.php @@ -25,7 +25,6 @@ the Free Software Foundation, either version 3 of the License, or */ - require_once(dirname(__FILE__)."/config.php"); require_once("common/functions.php"); //set_error_handler("error_handler"); @@ -49,22 +48,22 @@ if(php_sapi_name() !== "cli"){ ++$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); ++$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); ++$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); ++$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); ++$errors; } diff --git a/start.cmd b/start.cmd index 71a2fa4e8..1a960a67d 100644 --- a/start.cmd +++ b/start.cmd @@ -26,5 +26,5 @@ if not "%PHPOUTPUT%"=="1" ( echo [ERROR] Couldn't find PHP binary in PATH. ping 127.0.0.1 -n 3 -w 1000>nul ) else ( -START /B /WAIT php PocketMine-MP.php +START /B /WAIT php -d enable_dl=On PocketMine-MP.php ) \ No newline at end of file diff --git a/start.sh b/start.sh index 327de0c5a..2d816ceb2 100644 --- a/start.sh +++ b/start.sh @@ -1,2 +1,2 @@ #!/bin/bash -php PocketMine-MP.php \ No newline at end of file +php -d enable_dl=On PocketMine-MP.php \ No newline at end of file