Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: Tracing fatal error in php

  1. #1
    Join Date
    Jul 2012
    Posts
    197
    Thanks
    55
    Thanked 3 Times in 3 Posts

    Default Tracing fatal error in php

    Is there any way to find the cause of FATAL ERROR in php in which File/Line ?

  2. #2
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,982
    Thanks
    16
    Thanked 311 Times in 309 Posts
    Blog Entries
    11

    Default

    You can usually refer to the error log on your web host control panel.
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,028
    Thanks
    44
    Thanked 3,210 Times in 3,172 Posts
    Blog Entries
    12

    Default

    Look at the error message, it will usually give you that information. Example (I've removed part of the path for security reasons):

    Fatal error: Call to undefined function preg() in \demos\pdf\html2fpdf.php on line 463
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,982
    Thanks
    16
    Thanked 311 Times in 309 Posts
    Blog Entries
    11

    Default

    John is correct although you might get a blank screen - I think it depends on the server config.

    On both my web host's Apache servers I can edit the php.ini file so I get the on-screen errors as John advises. That makes for very convenient troubleshooting, but I also have an error log system that I can access if I log into my Control Panel. It's a pain that way but at least I can get to it the long way round if I need it.

    However, on the Windows/IIS servers that I access at work, I get zilch - a blank screen with a generic 500 Internal Error message, and at that point I have to check the error log file - sometimes via a Control Panel, if I'm using a 3rd party service, but on the in-house servers I can just browse the mapped-drive folder structure to the actual error log file.
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

  5. #5
    Join Date
    Jul 2012
    Posts
    197
    Thanks
    55
    Thanked 3 Times in 3 Posts

    Default

    Hi John

    Thanks for your message,
    Yes i got that, but it is a function ( create_admin() ) and that function is written in some other file
    Any idea to get the full details of that error interact with all pages (in which page this function is coded)..

  6. #6
    Join Date
    Jul 2012
    Posts
    197
    Thanks
    55
    Thanked 3 Times in 3 Posts

    Default

    On both my web host's Apache servers I can edit the php.ini file so I get the on-screen errors as John advises. That makes for very convenient troubleshooting, but I also have an error log system that I can access if I log into my Control Panel. It's a pain that way but at least I can get to it the long way round if I need it.
    Thanks but iam using Wamp
    I think fatal errors are hard to trace out

  7. #7
    Join Date
    Jul 2008
    Location
    Derbyshire, UK
    Posts
    1,982
    Thanks
    16
    Thanked 311 Times in 309 Posts
    Blog Entries
    11

    Default

    Im not sure what you mean by "trace out" but you can check the php.ini file in wamp and see where it is outputting the php_error.log file
    Focus on Function Web Design | Latest News RSS | Facebook | Twitter |
    Fast Edit (A flat file, PHP web page editor & CMS. Small, FREE, no database!) | Fast Edit BE (Snippet Manager) (Web content editor for multiple editable regions!) | Fast Apps |
    The only limit to creativity is imagination: JemCon.org

  8. #8
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,028
    Thanks
    44
    Thanked 3,210 Times in 3,172 Posts
    Blog Entries
    12

    Default

    Yes and you can set it (your php.ini) to report errors on screen. But from what you say, it looks like it already is. The php.ini file and PHP error log are both accessible from the Wamp server menu. Click on the Wamp server icon in your system tray or Win 7 hidden icons area. With Win XP, if you don't see the Wamp server icon, make sure that all tray icons are being shown, not just 'active' ones (it's a setting in XP accessible by right clicking on the system tray or menu bar). Once you click on the Wamp server icon and see its menu, hover over PHP, another menu will appear, from it click on the php.ini item or on the PHP error log item.

    Getting back to the error itself, the error should have some explanation, a filename and a line number. Open that file and go to that line number. Something there should pop on a light bulb for you. It might not seem obvious, but if you search Google for the error explanation, something should click.

    Now sometimes that won't work. Then you post about the specific error in the PHP forum here or in some other forum dedicated to the PHP script you're trying to run. Be prepared to provide a link to the live page and full source code of the server side files. If you cannot put it up live, make up a .zip file that has everything in it that someone would need to duplicate the error on their Wamp, or whatever server they're running it on. Make sure to include which PHP version you're using and exactly what you have to do to see the error. If it only happens sometimes, note that as well.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  9. #9
    Join Date
    Jul 2012
    Posts
    197
    Thanks
    55
    Thanked 3 Times in 3 Posts

    Default

    John

    Thanks for your message.
    My php error log file is displaying nothing, a blank one..
    can u explain how to point errors to that file..(php error log )
    My Apach Error log is displaying, same error what iam getting in browser...

    Rgds

  10. #10
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,028
    Thanks
    44
    Thanked 3,210 Times in 3,172 Posts
    Blog Entries
    12

    Default

    It doesn't matter which log it appears in, you aren't going to get any more information from Wamp about that particular error than was displayed in the browser.

    You have to go to that line in that file that the error points to and see if you can figure it out.

    If you want more help, we would need to see the exact error you are getting, copy and paste it here, as well as the file it points to. If the file is short you can paste its contents into a code block here. Otherwise, zip it up and attach it to a post. Since you said that the function that is mentioned in the error is defined in another file, we may need that too. We may even need other files, all the files required for us to run the code.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. Again an fatal error
    By ajfmrf in forum PHP
    Replies: 7
    Last Post: 09-05-2012, 03:01 AM
  2. Resolved Fatal error: Function name must be a string
    By Priyo in forum PHP
    Replies: 2
    Last Post: 02-07-2012, 06:12 PM
  3. Replies: 13
    Last Post: 01-03-2012, 04:51 AM
  4. Resolved Fatal Error?
    By sparklingsky in forum PHP
    Replies: 2
    Last Post: 04-17-2009, 02:43 AM
  5. Fatal error: MySQL and PHP
    By adriana_l_2000 in forum PHP
    Replies: 1
    Last Post: 03-12-2006, 06:31 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •