summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Jones <sixd@php.net>2009-03-16 05:34:02 +0000
committerChristopher Jones <sixd@php.net>2009-03-16 05:34:02 +0000
commitd14b84719d6a06d0201152e6867dc23dac4a43d8 (patch)
treedb26deda327d4ba590906f4971bfd79dffe05384
parentdd031eee68d5004ddebf2d699df79caabd8df3b9 (diff)
downloadphp-git-d14b84719d6a06d0201152e6867dc23dac4a43d8.tar.gz
MFH: Mac OSX customization for initialization error message
-rw-r--r--ext/oci8/oci8.c26
-rw-r--r--ext/oci8/tests/connect_without_oracle_home.phpt2
-rw-r--r--ext/oci8/tests/connect_without_oracle_home_old.phpt2
-rw-r--r--ext/oci8/tests/pecl_bug16035.phpt2
4 files changed, 17 insertions, 15 deletions
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 38139efaa7..3dff8427d5 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -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;
}
diff --git a/ext/oci8/tests/connect_without_oracle_home.phpt b/ext/oci8/tests/connect_without_oracle_home.phpt
index 41c9f5e284..42cbde8b48 100644
--- a/ext/oci8/tests/connect_without_oracle_home.phpt
+++ b/ext/oci8/tests/connect_without_oracle_home.phpt
@@ -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===
diff --git a/ext/oci8/tests/connect_without_oracle_home_old.phpt b/ext/oci8/tests/connect_without_oracle_home_old.phpt
index f6f44ddc16..82d8ae451b 100644
--- a/ext/oci8/tests/connect_without_oracle_home_old.phpt
+++ b/ext/oci8/tests/connect_without_oracle_home_old.phpt
@@ -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===
diff --git a/ext/oci8/tests/pecl_bug16035.phpt b/ext/oci8/tests/pecl_bug16035.phpt
index 7f5e9dd388..fc91bc91bc 100644
--- a/ext/oci8/tests/pecl_bug16035.phpt
+++ b/ext/oci8/tests/pecl_bug16035.phpt
@@ -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===