Symfony: 'zlib extension' missing

2019-08-09 02:35发布

问题:

I wanted to start with Symfony, but I even fail a the Quick Tour...

$ php -r "readfile('http://symfony.com/installer');" > symfony.phar
$ sudo mv symfony.phar /usr/local/bin/symfony
$ chmod a+x /usr/local/bin/symfony

$ symfony 
PHP Fatal error:  Uncaught exception 'PharException' with message 'zlib extension is required for gz compressed .phar file "/usr/local/bin/symfony"' in /usr/local/bin/symfony:9
Stack trace:
#0 /usr/local/bin/symfony(9): Phar::mapPhar('default.phar')
#1 {main}
  thrown in /usr/local/bin/symfony on line 9

Fatal error: Uncaught exception 'PharException' with message 'zlib extension is required for gz compressed .phar file "/usr/local/bin/symfony"' in /usr/local/bin/symfony:9
Stack trace:
#0 /usr/local/bin/symfony(9): Phar::mapPhar('default.phar')
#1 {main}
  thrown in /usr/local/bin/symfony on line 9

I have only rudimentary knowledge of apt-get and no idea how to install php extensions.

How can I solve this problem?

Ubuntu 12.04 LTS

php --version
PHP 5.5.3 (cli) (built: Sep  1 2013 14:29:12)

Thanks.

回答1:

I think PHP supports Zlib but it is not enable by default Here

You can add the option --with-zlib --with-zlib=DIR when you configure your php to enable the zlib.

Example:

php_5.6.7$ ./configure --with-zlib --with-zlib=DIR

Thank,