]> granicus.if.org Git - php/commitdiff
MFH: Mac OSX customization for initialization error message
authorChristopher Jones <sixd@php.net>
Mon, 16 Mar 2009 05:34:02 +0000 (05:34 +0000)
committerChristopher Jones <sixd@php.net>
Mon, 16 Mar 2009 05:34:02 +0000 (05:34 +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 38139efaa795ab90058c4fe4684190d19dd809d0..3dff8427d565336e6f1b251e97e449865f3b8cf5 100644 (file)
@@ -63,6 +63,16 @@ static PHP_GSHUTDOWN_FUNCTION(oci);
 #define Z_ADDREF_P(x) ZVAL_ADDREF(x)
 #endif
 
+/* 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;
@@ -987,13 +997,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;
@@ -2703,13 +2709,9 @@ static OCIEnv *php_oci_create_env(ub2 charsetid TSRMLS_DC)
 
        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 41c9f5e2849fd2ee22ca926df91b4c74b81fdb50..42cbde8b483af45b773529c0008c9e09ed601e68 100644 (file)
@@ -29,6 +29,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 f6f44ddc16e08a0c346839abdea6403df612d884..82d8ae451bc704e669fce1b179085c7c85da5ac4 100644 (file)
@@ -29,6 +29,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 7f5e9dd388076af7d999439fa036b4efbbc3de1d..fc91bc91bcaa6d82543bfdacce4a56c7fbe46174 100644 (file)
@@ -22,5 +22,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===