A question about php errors

Source: Internet
Author: User
I use the phpstudy2014 suite, but I have made some changes to make it compatible with php5.3 and 5.2.7 at the same time. conf {code ...} this is the configuration file of 5.2, because {code...} was used before ...} block all errors, but because of some... I used phpstudy2014's suite.
However, I have made some modifications to make php5.3 and 5.2.7 compatible at the same time.
Change to vhosts. conf


  
   LoadFile "D:/phpStudy/php52/php5ts.dll"LoadModule php5_module "D:/phpStudy/php52/php5apache2_4.dll"
   
    PHPIniDir "D:/phpStudy/php52/"
   LoadFile "D:/phpStudy/php52/libmysql.dll"LoadFile "D:/phpStudy/php52/libmcrypt.dll"
   
        SetHandler application/x-httpd-php
       DocumentRoot "F:\github\xinyupingtai"    ServerName d.hainuo.info    ServerAlias hainuo.info
  
  
       Options FollowSymLinks ExecCGI    AllowOverride All    Order allow,deny    Allow from all
  

This is the configuration file of 5.2.

error_reporting(0);

All errors are blocked, but the program output is blank for some reasons (I later found that I used an unintroduced method), so I changed the error reporterror_reporting(E_ALL);However, I found that the results caused me to crash. Baidu browser sent an error page directly, and ie11 gave me a blank page.

The principle of class import is

function __autoload($name){    $class_file = d('./class/' . $name . '.php');    if (file_exists($class_file)) {        include($class_file);    } else {        if (strpos($name, '_') !== false) {            $name = strtr($name, '_', '.');            if (!loadLib($name)) {                //exit('class '.$name.' not include');                return false;            }        } else {            //exit('class '.$name.' not include');            return false;        }    }}function loadLib($libName, $returnClass = false){    global $_libraryLoadLog;    if (!isset($_libraryLoadLog[$libName])) {        $libPath = WROOT . 'class' . D . strtr($libName, '.', D) . '.php';        if (file_exists($libPath)) {            if (($f = strrpos($libName, '.')) !== false) {                $libP = substr($libName, 0, $f) . '.'; //library parent            } else {                $libP = '';            }            include($libPath);            $_libraryLoadLog[$libName] = strtr($libName, '.', '_');        } else {            $_libraryLoadLog[$libName] = '';        }    }    if ($_libraryLoadLog[$libName]) {        if ($returnClass) {            $className = $_libraryLoadLog[$libName];            $class = new $className();            return $class;        } else {            return true;        }    }    return false;}

I used $ dom = file_get_html (url );
This method is self-contained in the simple_html_dom class.
Click the simpe html dom class link to view the source code of this class.
After using var_dump to test the cause, I realized that my dom class was not imported.

I want to ask you a lot about this question,
1. In this case, how did you debug the program?
2. Why is the output error still blank when an error is specified?
3. If the second line is hard to answer, could you explain the php Error Reporting principles?

6.27 modify
Because the method provided downstairs is not applicable
In one breath, I willerror_reporting(E_ALL);Comment out, mom. An error is reported.

Parse error: syntax error, unexpected '}' in F:\*****\lib\dialog.php on line 1018

Thank you for your help.

Reply content:

I used phpstudy2014's suite.
However, I have made some modifications to make php5.3 and 5.2.7 compatible at the same time.
Change to vhosts. conf


  
   LoadFile "D:/phpStudy/php52/php5ts.dll"LoadModule php5_module "D:/phpStudy/php52/php5apache2_4.dll"
   
    PHPIniDir "D:/phpStudy/php52/"
   LoadFile "D:/phpStudy/php52/libmysql.dll"LoadFile "D:/phpStudy/php52/libmcrypt.dll"
   
        SetHandler application/x-httpd-php
       DocumentRoot "F:\github\xinyupingtai"    ServerName d.hainuo.info    ServerAlias hainuo.info
  
  
       Options FollowSymLinks ExecCGI    AllowOverride All    Order allow,deny    Allow from all
  

This is the configuration file of 5.2.

error_reporting(0);

All errors are blocked, but the program output is blank for some reasons (I later found that I used an unintroduced method), so I changed the error reporterror_reporting(E_ALL);However, I found that the results caused me to crash. Baidu browser sent an error page directly, and ie11 gave me a blank page.

The principle of class import is

function __autoload($name){    $class_file = d('./class/' . $name . '.php');    if (file_exists($class_file)) {        include($class_file);    } else {        if (strpos($name, '_') !== false) {            $name = strtr($name, '_', '.');            if (!loadLib($name)) {                //exit('class '.$name.' not include');                return false;            }        } else {            //exit('class '.$name.' not include');            return false;        }    }}function loadLib($libName, $returnClass = false){    global $_libraryLoadLog;    if (!isset($_libraryLoadLog[$libName])) {        $libPath = WROOT . 'class' . D . strtr($libName, '.', D) . '.php';        if (file_exists($libPath)) {            if (($f = strrpos($libName, '.')) !== false) {                $libP = substr($libName, 0, $f) . '.'; //library parent            } else {                $libP = '';            }            include($libPath);            $_libraryLoadLog[$libName] = strtr($libName, '.', '_');        } else {            $_libraryLoadLog[$libName] = '';        }    }    if ($_libraryLoadLog[$libName]) {        if ($returnClass) {            $className = $_libraryLoadLog[$libName];            $class = new $className();            return $class;        } else {            return true;        }    }    return false;}

I used $ dom = file_get_html (url );
This method is self-contained in the simple_html_dom class.
Click the simpe html dom class link to view the source code of this class.
After using var_dump to test the cause, I realized that my dom class was not imported.

I want to ask you a lot about this question,
1. In this case, how did you debug the program?
2. Why is the output error still blank when an error is specified?
3. If the second line is hard to answer, could you explain the php Error Reporting principles?

6.27 modify
Because the method provided downstairs is not applicable
In one breath, I willerror_reporting(E_ALL);Comment out, mom. An error is reported.

Parse error: syntax error, unexpected '}' in F:\*****\lib\dialog.php on line 1018

Thank you for your help.

In order for php to output errors to the webpagedisplay_errors = On. This option is only used for local debugging. Do not open it online.

In php. inierror_log = /your/log/pathOption to control the file to which the error log is output, and you can view it after setting it to a convenient place.

Generally, debugging errors are combined with the log output by yourself. Of course, you can also use the debugging functions of Zend Studio IDE if you are running locally.

if (!ini_get('display_errors')) {    ini_set('display_errors', true);}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.