#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    4
    Rep Power
    0

    910814 - how to find my php errors?


    hi
    like what VS does for C++ source codes with Build (F7) command, i need a way to find errors and warnings a php code may consist of. since i'm an absolute newbie in programming with php, i need an assistant program for show me where i'm wrong.
    is there any?
    thx
  2. #2
  3. No Profile Picture
    Super Moderator
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,008
    Rep Power
    2791
    Welcome to DevShed, hamidi.

    Unfortunately there is no way to precisely track your logic or syntax errors in PHP, due to the fact that it is based solely on the 1950's ALGOL system language. You will need to remove one line at a time to see if your error goes away, which will most likely cause multiple other errors, which will then need to be addressed in the same manner. This is how you handle PHP errors.


    Just kidding. Add these lines to the top of your code.
    PHP Code:
    ini_set('display_errors',1); 
    error_reporting(E_ALL);
    [PHP] | [Perl] | [Python] | [Java] != [JavaScript] | [XML] | [ANSI C] | [C++] | [LUA] | [MySQL] | [FirebirdSQL] | [PostgreSQL] | [HTML] | [XHTML] | [CSS]

    W3Fools - A W3Schools Intervention.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    29
    Rep Power
    0
    Originally Posted by Winters
    Welcome to DevShed, hamidi.

    Unfortunately there is no way to precisely track your logic or syntax errors in PHP, due to the fact that it is based solely on the 1950's ALGOL system language. You will need to remove one line at a time to see if your error goes away, which will most likely cause multiple other errors, which will then need to be addressed in the same manner. This is how you handle PHP errors.


    Just kidding. Add these lines to the top of your code.
    PHP Code:
    ini_set('display_errors',1); 
    error_reporting(E_ALL);

    just kidding I said, what's going on ?
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    4
    Rep Power
    0
    hmm, i couldn't figure out. u mean adding the two lines at the top of my php file may show me the error occurred? if so, how can i see it? does it causes apache to log errors occurred in /var/log/apache2/error.log?
    kidding is ok, but consider that a beginner is confused enough with many things
    what i do is that i add a function as service to my php file at server and register it. then i go to VS to UpdateWebReference. i expect Reference.cs be updated with the function. but it doesn't cause it to include the function. during this, i guess there must has occurred an error.
    how can i find that?
    thx
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    29
    Rep Power
    0
    Originally Posted by hamidi
    hmm, i couldn't figure out. u mean adding the two lines at the top of my php file may show me the error occurred? if so, how can i see it? does it causes apache to log errors occurred in /var/log/apache2/error.log?
    kidding is ok, but consider that a beginner is confused enough with many things
    what i do is that i add a function as service to my php file at server and register it. then i go to VS to UpdateWebReference. i expect Reference.cs be updated with the function. but it doesn't cause it to include the function. during this, i guess there must has occurred an error.
    how can i find that?
    thx
    apache log is register all errors...So, you should use on the top of page the above code.which would say you all errors that you made.
  10. #6
  11. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    Those two lines will cause PHP to output the error to the screen when you execute the file. However, if your error is a syntax error rather than a runtime error it won't work, you need to adjust your php.ini file and set those two configuration parameters.

    what i do is that i add a function as service to my php file at server and register it. then i go to VS to UpdateWebReference. i expect Reference.cs be updated with the function. but it doesn't cause it to include the function. during this, i guess there must has occurred an error.
    I didn't follow this whole section.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo