PDA

View Full Version : [ubuntu] PHP Fatal error: Call to undefined function gzopen() in ... after upgrade



Waldo_Nell
April 19th, 2014, 03:41 AM
I have just upgraded from Ubuntu 12.04.4 LTS to 14.04. Part of that was to upgrade Apache 2.2 to 2.4 and PHP5 to 5.2.9.

Since the upgrade I keep on getting gzopen() failures:



root@xxx:~ # cat file.php
<?php


$handle = gzopen('/tmp/main.gz','w9');


?>


root@xxx:~ # php5 file.php

PHP Fatal error: Call to undefined function gzopen() in /tmp/file.php on line 3


root@xxx:~ # php5 -i | grep -i --color zlib
Registered PHP Streams => https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip
Registered Stream Filters => zlib.*, bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk
ZLib Version => 1.2.8
zlib
ZLib Support => enabled
Stream Wrapper => compress.zlib://
Stream Filter => zlib.inflate, zlib.deflate
zlib.output_compression => Off => Off
zlib.output_compression_level => -1 => -1
zlib.output_handler => no value => no value

Emeriz
April 19th, 2014, 05:25 AM
I am getting the exact same errors when calling gzopen() and have not been able to find any way around it so far.

Waldo_Nell
April 19th, 2014, 05:46 AM
Good to know I am not alone. I have another machine that was on 13.10, which I also upgraded to 14.04, which has the same PHP version and that machine works. I am at a loss.

Emeriz
April 19th, 2014, 08:30 AM
Hmm, my machine was 12.10 ==> 13.10 and later from 13.10==>14.04 to get me to a LTS version. I've thought about using a PPA to upgrade PHP to 5.5.11 or back to 5.4. I'm just not sure that will work. Re-installing php5-common did not help.

SeijiSensei
April 19th, 2014, 12:43 PM
There are Launchpad reports for this bug in 2009 or so. It apparently was fixed at that time. In one of the postings in the bug report, this workaround was suggested: https://bugs.launchpad.net/ubuntu/+source/php5/+bug/432291/comments/7

Emeriz
April 19th, 2014, 07:58 PM
I'm not sure what workaround that thread gives, but perhaps I just missed it. I did try to upgrade php to 5.5.11 via ppa:ondrej/php5 but I that fails due to unmet dependencies apparently. It seems that version is tied into apache and I am running nginx.

Waldo_Nell
April 19th, 2014, 08:03 PM
If the workaround is to change code, I cannot do that - the code belongs to an external component and changing it would mean maintaining it throughout the life of the system.

Emeriz
April 19th, 2014, 08:14 PM
I would prefer not to as well, but would as a short term solution. Still looking for an alternative.

Emeriz
April 19th, 2014, 08:51 PM
Okay, I was able to get stuff working again by changing the gzopen() reference to gzopen64() in my php files. I'm still running some things so we'll see if this is an overall solution.

Waldo_Nell
April 19th, 2014, 09:46 PM
That is interesting - that works for me too. Wonder why gzopen() does not then just call gzopen64()...