]> granicus.if.org Git - php/commitdiff
Mac OSX customization for initialization error message
authorChristopher Jones <sixd@php.net>
Mon, 16 Mar 2009 05:29:49 +0000 (05:29 +0000)
committerChristopher Jones <sixd@php.net>
Mon, 16 Mar 2009 05:29:49 +0000 (05:29 +0000)
ext/oci8/oci8.c
ext/oci8/tests/connect_without_oracle_home.phpt
ext/oci8/tests/connect_without_oracle_home_old.phpt
ext/oci8/tests/pecl_bug16035.phpt

index 7bafe568bc5fd7a598179f4810296a5e4b5a014e..25e5e6a7dbfc47ceb8fd71cd47099d17fa100a92 100644 (file)
@@ -51,6 +51,16 @@ ZEND_DECLARE_MODULE_GLOBALS(oci)
 static PHP_GINIT_FUNCTION(oci);
 static PHP_GSHUTDOWN_FUNCTION(oci);
 
+/* For a user friendly message about environment setup */
+/* TODO: add cases for SHLIB_PATH, LIBPATH, LD_LIBRARY_PATH_64 etc */
+#if defined(PHP_WIN32)
+#define PHP_OCI8_LIB_PATH_MSG "PATH"
+#elif defined(__APPLE__)
+#define PHP_OCI8_LIB_PATH_MSG "DYLD_LIBRARY_PATH"
+#else
+#define PHP_OCI8_LIB_PATH_MSG "LD_LIBRARY_PATH"
+#endif
+
 /* True globals, no need for thread safety */
 int le_connection;
 int le_pconnection;
@@ -852,13 +862,9 @@ static void php_oci_init_global_handles(TSRMLS_D)
 
        if (errstatus == OCI_ERROR) {
 #ifdef HAVE_OCI_INSTANT_CLIENT
-# ifdef PHP_WIN32
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIEnvNlsCreate() failed. There is something wrong with your system - please check that PATH includes the directory with Oracle Instant Client libraries");
-# else
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIEnvNlsCreate() failed. There is something wrong with your system - please check that LD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries");
-# endif
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIEnvNlsCreate() failed. There is something wrong with your system - please check that " PHP_OCI8_LIB_PATH_MSG " includes the directory with Oracle Instant Client libraries");
 #else
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory");
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and " PHP_OCI8_LIB_PATH_MSG " are set and point to the right directories");
 #endif
                OCI_G(env) = NULL;
                OCI_G(err) = NULL;
@@ -2599,14 +2605,11 @@ static OCIEnv *php_oci_create_env(ub2 charsetid TSRMLS_DC)
        PHP_OCI_CALL_RETURN(OCI_G(errcode), OCIEnvNlsCreate, (&retenv, OCI_G(events) ? PHP_OCI_INIT_MODE | OCI_EVENTS : PHP_OCI_INIT_MODE, 0, NULL, NULL, NULL, 0, NULL, charsetid, charsetid));
 
        if (OCI_G(errcode) != OCI_SUCCESS) {
+
 #ifdef HAVE_OCI_INSTANT_CLIENT
-# ifdef PHP_WIN32
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIEnvNlsCreate() failed. There is something wrong with your system - please check that PATH includes the directory with Oracle Instant Client libraries");
-# else
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIEnvNlsCreate() failed. There is something wrong with your system - please check that LD_LIBRARY_PATH includes the directory with Oracle Instant Client libraries");
-# endif
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIEnvNlsCreate() failed. There is something wrong with your system - please check that " PHP_OCI8_LIB_PATH_MSG " includes the directory with Oracle Instant Client libraries");
 #else
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory");
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and " PHP_OCI8_LIB_PATH_MSG " are set and point to the right directories");
 #endif
                return NULL;
        }
index cad7b9a404c8c6fa02b0ce71745e4f0a8de4845e..52d5e9c5f6fa5511bb6c60b64e9e352396f75fe9 100644 (file)
@@ -31,6 +31,6 @@ else {
 ===DONE===
 <?php exit(0); ?>
 --EXPECTF--
-Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory in %s on line %d
+Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and %s are set and point to the right directories in %s on line %d
 bool(false)
 ===DONE===
index 618d3407061094222faa3b806dfe33aa58e7a588..85d8668056a694d1b99c54a69f7a3d499637b1e7 100644 (file)
@@ -31,6 +31,6 @@ else {
 ===DONE===
 <?php exit(0); ?>
 --EXPECTF--
-Warning: ocilogon(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory in %s on line %d
+Warning: ocilogon(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and %s are set and point to the right directories in %s on line %d
 bool(false)
 ===DONE===
index 316f0c7cb39f69e863b8945bc079da856ad99127..447e398de07a3f8729bbd3b933fd52ed6cb5837c 100644 (file)
@@ -23,5 +23,5 @@ oci_connect('abc', 'def', 'ghi', 'jkl');
 ===DONE===
 <?php exit(0); ?>
 --EXPECTF--
-Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME is set and points to the right directory in %s on line %d
+Warning: oci_connect(): OCIEnvNlsCreate() failed. There is something wrong with your system - please check that ORACLE_HOME and %s are set and point to the right directories in %s on line %d
 ===DONE===