0

My php code is in the hostgator server and since I have to write a few scripts I don't have to install the wamp/lamp server.

I did a bit digging and found extensions namely PHP console. I added it and tested once, it showed me the line number of the errror.

But after a few hours when I tested the extension it is not working anymore for the same script and the same error.

I also tried another popular extension called Xdebug helper. But that also seems to be not working.

To test I have removed a semicolon in my working script and the link is : http://arqamahmad.com/music_app/getmusic.php

PS : I am using a shared hostgator server and I have done my research on the .htaccess and php.ini files. Nothing is helpful. The PHP console extension was the best but there seems to be some problem to that.

Answer : I had to add a php.ini file inside public_http making allowing the php debug mode on then only it the extensions work.

arqam
  • 3,582
  • 5
  • 34
  • 69

2 Answers2

3

For Firefox, there is FirePHP (http://www.firephp.org/) in combination with Firebug. There is a similar extension for Chrome, but I haven’t tested that (https://github.com/itsgoingd/clockwork-chrome).

The general thing is that you need to somehow transfer your error messages from PHP back to the client. If you don’t want to use a browser extension for that, you can also use an approach chosen by many frameworks (e.g. Symfony): add an admin module in your page, where the error messages are displayed (you need to intercept errors on the servers for that, by registering a custom error handler).

Edit: This of course requires PHP to output error messages at all, which depends on (among others) the php.ini settings like error_reporting, which need to be set to a level that the errors you desire for reporting will trigger the error handler functions.

Concerning your remark about Xdebug: to use Xdebug helper, Xdebug (a PHP extension for debugging) needs to be available on the server, which it usually is not on production systems.

Andreas Wolf
  • 995
  • 6
  • 19
  • Please remove the answer as it is not helpful. I found the problem solution. We have to make a php.ini file and then allow debugging mode on in that file, then only it will show the errors. If you can edit it then I can accept the answer. – arqam Aug 29 '16 at 16:20
  • 1
    @arqam "Thanks for your answer! I found a different approach, but I appreciate the effort you put in." is a lot better than "Not useful. Not helpful. Remove your answer." – ceejayoz Aug 29 '16 at 20:33
  • @ceejayoz The answer written doesn't work. The readers will waste their time going by that. – arqam Aug 30 '16 at 10:15
  • @arqam There are much less rude ways of saying so. – ceejayoz Aug 30 '16 at 12:46
  • 1
    @arqam Incidentally, everything in this answer works if you have the ability to configure the server. The problem is you're on a crappy shared host, which limits what you can do. That's not AndreasWolf's fault. – ceejayoz Aug 30 '16 at 12:47
0

Since php is executed on the server side, no browser add-on will help you. You need to add a few lines of code to the php file to show the errors.

Here's a link for you: https://stackoverflow.com/a/21429652/6735510

Community
  • 1
  • 1
RaitzeR
  • 1
  • 1
  • That is also for the internal server. I did my digging. If you know any way then answer this unanswered question of mine : http://stackoverflow.com/questions/39201110/how-to-enable-php-display-error-on-in-my-cpanel – arqam Aug 29 '16 at 15:41