Problems with include.

Topics: Developer Forum, User Forum
May 15, 2009 at 10:11 AM

Hi !

I've a problem with that script... The include doesn't work, i tried a lot of things but the script stop at the very beginning, when i've to include "PHPExcel.php"

My include_path is correct, and it does that on my server even for the files of Tests... I just don't understand what's happening... It happen nothing...

Does anyone knows the solution?

May 15, 2009 at 10:24 AM

Try to put this at the beginning of your script, and tell us if you get any error messages:

ini_set('display_errors', '1');

May 15, 2009 at 10:38 AM

I don't have any error message... It's just an empty page.

Here is my code (my file is in /public/www/backoffice/PHPExcel/Tests/ and i'm just trying to create an empty file there) :

ini_set('display_errors', '1');
set_include_path(get_include_path() . PATH_SEPARATOR . '../Classes/');

echo "Include PHPExcel";
include 'PHPExcel.php';

echo "Include IO";
include 'PHPExcel/IOFactory.php';

$objPHPExcel = new PHPExcel();

$writer = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');


And here is the result in a white page:

Include PHPExcel

(and if i don't put any echos, it doesn't work too...)






May 15, 2009 at 11:01 AM

Sounds strange. Try to edit PHPExcel.php putting some echo statement at the top like this in that file:

echo 'hello';exit;
/** PHPExcel_Cell */
require_once 'PHPExcel/Cell.php';

If you see the 'hello' message, start moving the line downwards until you find out where the script stops. That way the error can be tracked down.

May 15, 2009 at 11:12 AM

Strange... It comes from require_once 'PHPExcel/Shared/ZipStreamWrapper.php';

It shows hello every where before this line... But i never touch it or change anything... And it seems totally normal...


May 15, 2009 at 11:22 AM

Do you error message if you change this in ZipStreamWrapper.php:

    public static function register() {
        @stream_wrapper_register("zip", __CLASS__);

to this

    public static function register() {
        stream_wrapper_register("zip", __CLASS__);

May 15, 2009 at 1:47 PM

You were right !

The problem comme from those function :

Fatal error: Call to undefined function stream_wrapper_unregister() in [..]/public/www/backoffice/PHPExcel/Classes/PHPExcel/Shared/ZipStreamWrapper.php on line 73

Did you ever got this problem??

May 15, 2009 at 4:59 PM

Can you check what version of PHP you are using? According to the PHP documentation, that function should be available in PHP 5.1.0 and higher: