symfony - php5.4.6 compiled by myself cannot run composer
怪我咯
怪我咯 2017-05-16 16:45:33
0
2
606

When I tried to use curl and pipe operators to pass it directly to php to execute the downloaded install, I got an error:

$ curl -s https://getcomposer.org/installer | php
#!/usr/bin/env php
All settings correct for using Composer
Downloading...
The download is corrupt, retrying...
Downloading...
The download is corrupt, retrying...
Downloading...
The download is corrupt (internal corruption of phar "/work/doc/composer.phar" (truncated entry)), aborting.

Then I downloaded the install manually:

$ curl -s https://getcomposer.org/installer > composer

Then manually trace where the error occurred, and then traced a try...catch statement:

......

try {
            // test the phar validity
            echo $file;
            $phar = new Phar($file);
            // free the variable to unlock the file
            unset($phar);
            break;
        } catch (Exception $e) {
            if (!$e instanceof UnexpectedValueException && !$e instanceof PharException) {
                throw $e;
            }
            unlink($file);
            if ($retries) {
                if (!$quiet) {
                   out('The download is corrupt, retrying...', 'error');
                }
            } else {
                out('The download is corrupt ('.$e->getMessage().'), aborting.', 'error');
                exit(1);
            }
        }
        
......

An error occurred when using new Phar, so I took out this code and executed it separately. PHP reported this error:

$ cat test.php 
<?php

$file = '/work/doc/composer.phar';

$phar = new Phar($file);

unset($phar);

Then execute this test.php and see this error:

$ php test.php 
PHP Fatal error:  Uncaught exception 'UnexpectedValueException' with message 'internal corruption of phar "/work/doc/composer.phar" (__HALT_COMPILER(); not found)' in /work/doc/test.php:5
Stack trace:
#0 /work/doc/test.php(5): Phar->__construct('/work/doc/compo...')
#1 {main}
  thrown in /work/doc/test.php on line 5

Fatal error: Uncaught exception 'UnexpectedValueException' with message 'internal corruption of phar "/work/doc/composer.phar" (__HALT_COMPILER(); not found)' in /work/doc/test.php:5
Stack trace:
#0 /work/doc/test.php(5): Phar->__construct('/work/doc/compo...')
#1 {main}
  thrown in /work/doc/test.php on line 5

But I already have a downloaded script named composer.phar. Even if I named test.php composer.phar, it doesn’t work. Here are the compilation parameters of my PHP:

./configure --prefix=/opt/php/default --with-config-file-path=/opt/php/default/etc --with-mysql --with-mysqli --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fpm --enable-mbstring --with-mcrypt --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-libdir=lib64 --with-xmlrpc --enable-zip --enable-soap --with-pear --enable-pdo --with-pdo-mysql --with-gettext --enable-exif --enable-wddx --enable-calendar --enable-ftp --enable-dba --enable-sysvmsg --enable-sysvshm --enable-debug --enable-maintainer-zts --with-pcre-regex --enable-gd-jis-conv --with-apxs2=/opt/apache/default/bin/apxs
怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(2)
Peter_Zhu

Run this down,

$ ./configure --help | grep curlwrappers

You should be able to see that this option is "experimental", and there is no official description of curl as a wrapper in http://us.php.net/manual/en/wrappers....

Besides, it will indeed cause fopen to work abnormally.

巴扎黑

Remove the --with-curlwrappers parameter during compilation and the problem is solved. I don’t know exactly why.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template