9

We have set up Weblogic to be able to run PHP, this link was used as a guide http://archive.oreilly.com/cs/user/view/cs_msg/25690. We can successfully use PHP albeit only 5.3.9.

One thing that I am having trouble with is displaying all of PHPs errors. When PHP errors in some circumstances it just shows the server error:

Error 500--Internal Server Error From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1: 10.5.1 500 Internal Server Error The server encountered an unexpected condition which prevented it from fulfilling the request.

I have a local version of PHP (5.6.4) with the same phpinfo() outputs for display_errors => STDOUT => STDOUT and error_reporting => 32767 => 32767 and it will output the errors.

A quick example of errors it won't display are say I get a function name wrong or mistype a language construct like echo, I'll get the server error not the parse error: message: line.

I've never used PHP on weblogic before, so I'm not sure of what this problem is or how to fix it?

Jonnny
  • 4,939
  • 11
  • 63
  • 93
  • @HPierce we checked the logs and it just says PHP error – Jonnny Sep 27 '15 at 17:43
  • Yikes! I totally just proved myself wrong. PHP _will_ produce 500 errors when error reporting is fully turned off. I imagine you have already looked at [this question](http://stackoverflow.com/questions/1053424/how-do-i-get-php-errors-to-display)? While errors were not being reported, I found the errors were being logged in my php error.log (which might be a better place for them to show up when running on your production server anyway) – HPierce Sep 29 '15 at 21:28
  • 1
    @HPierce I hadn't but I did just double check the answer and try to implement it. No change. I didn't have a php_errors.log in my set up so i made one a few days ago, it's empty – Jonnny Sep 30 '15 at 11:48
  • your OS is windows or Linux? if its linux maybe the error_log path is not writeable by your current user or weblogic'user – Santa's helper Oct 02 '15 at 07:59

1 Answers1

5

Jonnny, are you sure there was no previous error_log setup in your php.ini?

I did a test install of 5.3.9 and got C:\WINDOWS\temp\php-errors.log What does phpinfo() say for the error_log and log_errors directives?

If you want parse errors to be returned to the browser (via stdout) then the value for error_log must be blank or just ensure error_log is not set anywhere

This was my default php.ini and when I checked the log it was was working, including parse errors.

log_errors=On
error_log="C:\WINDOWS\temp\php-errors.log"
Steve E.
  • 9,003
  • 6
  • 39
  • 57
  • BTW Jonnny, are you using the php.exe or the php-cgi.exe executable? – Steve E. Oct 01 '15 at 15:29
  • No, there was no error log previously. I also looked for one in the temp files as it says that's where it should be but there wasn't one. I tried the changes mentioned to see about either generating a log or outputting to the browser and no such luck. From the link in my question it seems to be a php as a cgi extension. I can see a php.exe in my base folder – Jonnny Oct 01 '15 at 16:11
  • Ok, if it's the php.exe, then you should be able to create a test PHP file and run from the cmd line `php.exe test.php`. Add an error and see if it outputs or logs anything. – Steve E. Oct 01 '15 at 18:58
  • I've just run it in cmd line and a simple parse error is returned to the command line – Jonnny Oct 02 '15 at 17:02
  • Great, at least the error is reported. Just to confirm my earlier question. What does phpinfo() say for the `error_log` and `log_errors` directives? Assuming `display_errors => STDOUT => STDOUT` and `error_reporting => 32767` still as well. Run phpinfo(); via the weblogic fserver and from cmd line just in case the results are different. – Steve E. Oct 03 '15 at 17:55
  • The web app says: `error_log => no value => no value` + `log_errors => Off => Off` + `display_errors => STDOUT => STDOUT` + `error_reporting => 32767 => 32767`. I ran `echo "" | php > phpinfo.txt` from my command line and got back: `error_log => no value => no value`, `log_errors => Off => Off`, `display_errors => STDOUT => STDOUT` and `error_reporting => 32767 => 32767` – Jonnny Oct 05 '15 at 10:49
  • As you can see, no error_log is specified. This is why it's not logging to file. Are you sure this is not set to a specified file in your php.ini? Check for other occurrences of the directive as only the first is recognised. – Steve E. Oct 05 '15 at 12:42
  • But if I want the errors in the browser I wouldn't need the error_log filled in would i? It is not specified to a file in my php.ini. I commented it out in a hope to get the error sent to the browser – Jonnny Oct 05 '15 at 12:46
  • From what you have said, it sounds like weblogic is going to block those and replace them with it's own 500 error. Possibly, PHP parse errors are occurring before the HTTP headers which would be an invalid response and this is why weblogic blocks them. – Steve E. Oct 05 '15 at 13:38