English 中文(简体)
Prestashop no errors / blank page
原标题:

I m developing a module in PHP for Prestashop and I m having a tough time trying to debug code. Whenever something falls over it doesn t display errors, just a blank page - either on the front end where the module is hooked, or on the back end module page.

I m trying to write in another class, or another function but it doesn t like it at all.

It s on a local dev server, PHP errors are on etc.

Can somebody tell me any other way to debug stuff instead of commenting out code? Or some way of getting error codes?

Thanks for your help in advance.

最佳回答

Try opening config/config.inc.php and then change:

@ini_set( display_errors , off )

to

@ini_set( display_errors , on ).


From PS 1.5+, you need to open config/defines.inc.php and change:

define( _PS_MODE_DEV_ , false);

to

define( _PS_MODE_DEV_ , true);

问题回答

Go to your backoffice page.

Advanced Params -> Performance -> Clean Cache (Eraser Icon)

I had to do

aptitude install php5-mcrypt sudo aptitude install php5-mcrypt sudo service apache2 restart

The encryption was not installed

check this out for the final solution!

First of all, you need to enable errors reporting on your website.

1) Open the file configconfig.inc.php and find the following line:

@ini_set(‘display_errors’, ‘off’);    

2) Change ‘off’ to ‘on’, re-upload the file and refresh your page.

If it doesn’t help, go to the next step.

3)Add this code to the top of your index.php file in the root of PrestaShop installation and re-upload it on your server. Then try to access your website and admin panel.

    <?php error_reporting(0); 
       $old_error_handler = set_error_handler("userErrorHandler");

       function userErrorHandler ($errno, $errmsg, $filename, $linenum,  $vars) 
     {
     $time=date("d M Y H:i:s"); 
     // Get the error type from the error number 
     $errortype = array (1    => "Error",
                         2    => "Warning",
                         4    => "Parsing Error",
                     8    => "Notice",
                     16   => "Core Error",
                     32   => "Core Warning",
                     64   => "Compile Error",
                     128  => "Compile Warning",
                     256  => "User Error",
                     512  => "User Warning",
                     1024 => "User Notice");
  $errlevel=$errortype[$errno];

  //Write error to log file (CSV format) 
  $errfile=fopen("errors.csv","a"); 
  fputs($errfile,""$time","$filename: 
  $linenum","($errlevel) $errmsg"
"); 
  fclose($errfile);

  if($errno!=2 && $errno!=8) {
     //Terminate script if fatal error
     die("A fatal error has occurred. Script execution has been aborted");
  } 
   }
?>

After this manipulations you will find the file called errors.csv in the folder where your index.php file is located. Download and open the file errors.csv using any text editor, you will find the error log there.

In my case (PS 1.7) i had blank screen after massively adding many products. I also noticed it was a blank screen with error 500 (i got it from the browser console).

The solution was to simply increase the memory limit of my PHP. It can be done by adding this line to the beginning of index.php file:

ini_set( memory_limit , 512M );

I solved with 512M, but you can try more if the problem still persists.

This is just a temporary/fast solution, if you want it persistent, you can change directly that value at the source, find your php.ini and just edit the value on the memory_limit field.

You can find more info here: https://www.inmotionhosting.com/support/prestashop-16/blank-screen

I just renamed class_index.php in /cache directory to something class.index.old.php , then reloaded site - and voila! site was loaded. And in this directory new class_index.php was created.





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签