PHP on OpenShift: How to enable errors and warning

2019-06-24 04:06发布

问题:

I have moved my app to OpenShift and now, for convenience of getting it actually work, I'd like to enable in-page errors and warnings. Currently, I see a blank page.

How can I enable errors?

In PHP, it's in php.ini

error_reporting = E_ALL
display_errors = 1

回答1:

On the IRC channel #openshift, I was told that this is not currently not configurable

(05:06:58 PM) pmorie: ozizka-ntb: it looks like it's provided by the cart - i don't believe you can substitute your own

and I need to use both

error_reporting(E_ALL);
ini_set('display_errors', 1);


回答2:

You might want to set APPLICATION_ENV to development.

$ rhc env set APPLICATION_ENV=development

According to https://developers.openshift.com/en/php-getting-started.html,

In development mode, your application will:

  1. Show more detailed errors in browser
  2. Display startup errors
  3. Enable the Xdebug PECL extension
  4. Enable APC stat check
  5. Ignore your composer.lock file (if applicable)


回答3:

If you can't access php.ini then write this on top of your php page:

<?php
error_reporting(22527);
?>

This displays all errors and warnings in the page.



标签: php openshift