diff --git a/views/plugins/views_plugin_style_json.inc b/views/plugins/views_plugin_style_json.inc
index 7379025..9869027 100644
--- a/views/plugins/views_plugin_style_json.inc
+++ b/views/plugins/views_plugin_style_json.inc
@@ -164,7 +164,7 @@ class views_plugin_style_json extends views_plugin_style {
     );
     
     // Only enable options supported by the current PHP version.
-    if(!(PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 4)) {
+    if(!defined('PHP_MAJOR_VERSION') || !(PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 4)) {
       $php5_4_ops = array('bigint_string', 'pretty_print', 'unescaped_slashes', 'unescaped_unicode');
       foreach($php5_4_ops as $op) {
         $form[$op]['#disabled'] = TRUE;
diff --git a/views_json.module b/views_json.module
index 6ddd2f4..22e4b7d 100644
--- a/views_json.module
+++ b/views_json.module
@@ -351,7 +351,7 @@ function _views_json_debug_stop($var, $location) {
  *   Integer to use as the $bitmask parameter for json_encode().
  */
 function _views_json_json_encode($rows, $bitmask = NULL) {
-  if(PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3) {
+  if(!defined('PHP_MAJOR_VERSION') || !PHP_MAJOR_VERSION >= 5 && PHP_MINOR_VERSION >= 3) {
     $json = json_encode($rows, $bitmask);
     // Encoding features not supported before 5.4.x.
     if(PHP_MINOR_VERSION <= 4) {
