PHP on OpenShift: How to enable errors and warnings?

夙愿已清 提交于 2019-12-10 15:39:28

问题


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.



来源:https://stackoverflow.com/questions/12582409/php-on-openshift-how-to-enable-errors-and-warnings

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!