Ubuntu

"Fatal error: Call to undefined function gzopen()" on php5 5.2.10.dfsg.1-2ubuntu3

Reported by bellbind on 2009-09-18
56
This bug affects 11 people
Affects Status Importance Assigned to Milestone
php5 (Ubuntu)
Undecided
Unassigned
Nominated for Karmic by Andreas Otto

Bug Description

Binary package hint: php5

"Fatal error: Call to undefined function gzopen()" on php5 5.2.10.dfsg.1-2ubuntu3

The error does not occur on php5 5.2.6.dfsg..1-3ubuntu4.2 (jaunty package)

----

$ cat sample.php
<?php
$data = "Hello World!";
$gzfile = gzopen("hello.txt.gz", "w9");
gzwrite($gzfile, $data);
gzclose($gzfile);
?>
$ php sample.php

Fatal error: Call to undefined function gzopen() in /home/bellbind/experiment/php/gz/sample.php on line 3

$ lsb_release -rd
Description: Ubuntu karmic (development branch)
Release: 9.10

[added: Ubuntu 9.10, 5.2.10.dfsg.1-2ubuntu5, same problem]

Chuck Short (zulcss) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Please answer these questions:
1. Is this reproducible?
2. If so, what specific steps should we take to recreate this bug? Be as detailed as possible.
This will help us to find and resolve the problem.

Changed in php5 (Ubuntu):
status: New → Incomplete
bellbind (bellbind) wrote :

1. Is this reproducible? -> yes. I use i386 binaries via "jp.archive.ubuntu.com".
2. I always do dist-upgrade with wajig. I can reproduce the bug with extracted php5 command in cached deb files.

---- hash for deb ---
$ sha1sum /var/cache/apt/archives/php5-cli_5.2.10.dfsg.1-2ubuntu3_i386.deb
86dfb40d2c31ff9c2763f5f2984550e205a09786 /var/cache/apt/archives/php5-cli_5.2.10.dfsg.1-2ubuntu3_i386.deb

---- script ---
$ emacs sample.php # previous php script
$ mkdir 5.2.6 5.2.10
$ dpkg-deb -x /var/cache/apt/archives/php5-cli_5.2.6.dfsg.1-3ubuntu4.2_i386.deb 5.2.6/
$ dpkg-deb -x /var/cache/apt/archives/php5-cli_5.2.10.dfsg.1-2ubuntu3_i386.deb 5.2.10/
$ ./5.2.10/usr/bin/php5 sample.php

Fatal error: Call to undefined function gzopen() in /home/bellbind/experiment/php/ubuntu/sample.php on line 3
$ ./5.2.6/usr/bin/php5 sample.php # work well in my env.

Chuck Short (zulcss) wrote :

Installing the packages the normal way, I cannot reproduce this error at all.

Regards
chuck

Changed in php5 (Ubuntu):
status: Incomplete → Won't Fix
bellbind (bellbind) wrote :

The error also occurs when use package php5-5.2.10.dfsg.1(5.2.10.dfsg.1-2ubuntu4) rebuilded in my machine.

But, it changes well when uncomment the line:

#019-z_off_t_as_long.patch

to

019-z_off_t_as_long.patch

in "debian/patches/series" before dpkg-buildpackage.

wooster (hampusr) wrote :

I can reproduce this bug.

php -v

PHP 5.2.10-2ubuntu4 with Suhosin-Patch 0.9.7 (cli) (built: Sep 18 2009 15:43:11)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

cat t.php

<?php
$fp = gzopen("file.gz", "r");
?>

php t.php

Fatal error: Call to undefined function gzopen()

From package description:
The following extensions are built in: ... zlib.

uname :
2.6.31-11-generic #38-Ubuntu SMP Fri Oct 2 11:55:55 UTC 2009 i686 GNU/Linux

bellbind (bellbind) wrote :

Same error is occured at 5.2.10.dfsg.1-2ubuntu5 .

bellbind (bellbind) wrote :

The bug is NOT zlib link problem because it can open gz files with "fopen" for example:

<?php
$gzfile = fopen("compress.zlib://hello.txt.gz", "w");
fwrite($gzfile, "hello world!");
fclose($gzfile);
?>

is work well on released binaries. BUT "gzopen" is not defined in php5 binaries it cannot run:

<?php
$data = "Hello World!";
$gzfile = gzopen("hello.txt.gz", "w9");
gzwrite($gzfile, $data);
gzclose($gzfile);
?>

bellbind (bellbind) wrote :

The uncomment patch "019-z_off_t_as_long.patch" changes the situation in my environment build.

The patch only adds header files to php5 sources: "ext/zlib/zconf.h" and "ext/zlib/zlib.h"
But in my env, it also exists "/usr/include/zconf.h" and "/usr/include/zlib.h" by standard package "zlib1g-dev".

I don't know why the existence of the header files changes the build condition...

Rajoy (siberia-accanto) wrote :

Happens for me too, Ubuntu 9.10, 5.2.10.dfsg.1-2ubuntu5.

description: updated
Andreas Otto (andreas-otto) wrote :

Happens for me as well with Ubuntu 9.10, 5.2.10.dfsg.1-2ubuntu6.

lsd_xtc (lsd-dev) wrote :

Hi.. same thing for me... gzopen works fine on my 9.04 but after update to 9.10 it is not working:

lsd@lsd-asus-ubuntu:~$ php -v
PHP 5.2.10-2ubuntu6 with Suhosin-Patch 0.9.7 (cli) (built: Oct 23 2009 16:30:10)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
    with eAccelerator v0.9.5.3, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
    with the ionCube PHP Loader v3.1.34, Copyright (c) 2002-2009, by ionCube Ltd.

lsga (ls-gacartigas) wrote :

hi. I'm using Magento (most used eCommerce framework in the world...)
Magento does not work with PHP 5.3 (as many CMS and frameworks).

So, as many people, I needed to downgrade to PHP 5.2.10 with the very popular trick :
http://dustyreagan.com/downgrade-php-5-3-to-5-2/comment-page-1/

But now, I have the gzopen bug.
I'm a webdevelopper, not a sysadmin. I use Ubuntu because it suppose to be 'easy to use'. I felt yet difficult and weird the downgrading of PHP.

Now, what I'm suppose to do for Ubuntu being able to run Magento ?
Could you please explain in a 'step by step way' how to fix this bug ?

thanks.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers