Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer Install generates many php Module already loaded warnings php 7.1 #5783

Closed
red-smeg opened this issue Oct 12, 2016 · 28 comments

Comments

@red-smeg
Copy link

commented Oct 12, 2016

When I run this command:

composer Install

I get the following output:

Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets
Cannot load Zend OPcache - it was already loaded
PHP Warning: Module 'mysqlnd' already loaded in Unknown on line 0
PHP Warning: Module 'PDO' already loaded in Unknown on line 0
PHP Warning: Module 'xml' already loaded in Unknown on line 0
PHP Warning: Module 'calendar' already loaded in Unknown on line 0
PHP Warning: Module 'ctype' already loaded in Unknown on line 0
PHP Warning: Module 'curl' already loaded in Unknown on line 0
PHP Warning: Module 'dom' already loaded in Unknown on line 0
PHP Warning: Module 'exif' already loaded in Unknown on line 0
PHP Warning: Module 'fileinfo' already loaded in Unknown on line 0
PHP Warning: Module 'ftp' already loaded in Unknown on line 0
PHP Warning: Module 'gd' already loaded in Unknown on line 0
PHP Warning: Module 'gettext' already loaded in Unknown on line 0
PHP Warning: Module 'iconv' already loaded in Unknown on line 0
PHP Warning: Module 'intl' already loaded in Unknown on line 0
PHP Warning: Module 'json' already loaded in Unknown on line 0
PHP Warning: Module 'mbstring' already loaded in Unknown on line 0
PHP Warning: Module 'mcrypt' already loaded in Unknown on line 0
PHP Warning: Module 'mysqli' already loaded in Unknown on line 0
PHP Warning: Module 'pdo_mysql' already loaded in Unknown on line 0
PHP Warning: Module 'Phar' already loaded in Unknown on line 0
PHP Warning: Module 'posix' already loaded in Unknown on line 0
PHP Warning: Module 'readline' already loaded in Unknown on line 0
PHP Warning: Module 'shmop' already loaded in Unknown on line 0
PHP Warning: Module 'SimpleXML' already loaded in Unknown on line 0
PHP Warning: Module 'sockets' already loaded in Unknown on line 0
PHP Warning: Module 'sysvmsg' already loaded in Unknown on line 0
PHP Warning: Module 'sysvsem' already loaded in Unknown on line 0
PHP Warning: Module 'sysvshm' already loaded in Unknown on line 0
PHP Warning: Module 'tokenizer' already loaded in Unknown on line 0
PHP Warning: Module 'wddx' already loaded in Unknown on line 0
PHP Warning: Module 'xmlreader' already loaded in Unknown on line 0
PHP Warning: Module 'xmlwriter' already loaded in Unknown on line 0
PHP Warning: Module 'xsl' already loaded in Unknown on line 0

Trying to install assets as relative symbolic links.


  Bundle                         Method / Error    

✔ AirnavWebBundle relative symlink
✔ FrameworkBundle relative symlink
✔ JMSTranslationBundle relative symlink
✔ WhiteOctoberPagerfantaBundle relative symlink
✔ FOSJsRoutingBundle relative symlink
✔ GosWebSocketBundle relative symlink


And I expected this to happen:

Trying to install assets as relative symbolic links.


  Bundle                         Method / Error    

✔ AirnavWebBundle relative symlink
✔ FrameworkBundle relative symlink
✔ JMSTranslationBundle relative symlink
✔ WhiteOctoberPagerfantaBundle relative symlink
✔ FOSJsRoutingBundle relative symlink
✔ GosWebSocketBundle relative symlink


I have checked my php cli php.ini and its --info is

Configuration File (php.ini) Path: /etc/php/7.1/cli
Loaded Configuration File: /etc/php/7.1/cli/php.ini
Scan for additional .ini files in: /etc/php/7.1/cli/conf.d
Additional .ini files parsed: /etc/php/7.1/cli/conf.d/10-mysqlnd.ini,
/etc/php/7.1/cli/conf.d/10-opcache.ini,
/etc/php/7.1/cli/conf.d/10-pdo.ini,
/etc/php/7.1/cli/conf.d/15-xml.ini,
/etc/php/7.1/cli/conf.d/20-calendar.ini,
/etc/php/7.1/cli/conf.d/20-ctype.ini,
/etc/php/7.1/cli/conf.d/20-curl.ini,
/etc/php/7.1/cli/conf.d/20-dom.ini,
/etc/php/7.1/cli/conf.d/20-exif.ini,
/etc/php/7.1/cli/conf.d/20-fileinfo.ini,
/etc/php/7.1/cli/conf.d/20-ftp.ini,
/etc/php/7.1/cli/conf.d/20-gd.ini,
/etc/php/7.1/cli/conf.d/20-gettext.ini,
/etc/php/7.1/cli/conf.d/20-iconv.ini,
/etc/php/7.1/cli/conf.d/20-intl.ini,
/etc/php/7.1/cli/conf.d/20-json.ini,
/etc/php/7.1/cli/conf.d/20-mbstring.ini,
/etc/php/7.1/cli/conf.d/20-mcrypt.ini,
/etc/php/7.1/cli/conf.d/20-mysqli.ini,
/etc/php/7.1/cli/conf.d/20-pdo_mysql.ini,
/etc/php/7.1/cli/conf.d/20-phar.ini,
/etc/php/7.1/cli/conf.d/20-posix.ini,
/etc/php/7.1/cli/conf.d/20-readline.ini,
/etc/php/7.1/cli/conf.d/20-shmop.ini,
/etc/php/7.1/cli/conf.d/20-simplexml.ini,
/etc/php/7.1/cli/conf.d/20-sockets.ini,
/etc/php/7.1/cli/conf.d/20-sysvmsg.ini,
/etc/php/7.1/cli/conf.d/20-sysvsem.ini,
/etc/php/7.1/cli/conf.d/20-sysvshm.ini,
/etc/php/7.1/cli/conf.d/20-tokenizer.ini,
/etc/php/7.1/cli/conf.d/20-wddx.ini,
/etc/php/7.1/cli/conf.d/20-xmlreader.ini,
/etc/php/7.1/cli/conf.d/20-xmlwriter.ini,
/etc/php/7.1/cli/conf.d/20-xsl.ini,
/etc/php/7.1/cli/conf.d/zzzz_custom.ini

@red-smeg

This comment has been minimized.

Copy link
Author

commented Oct 12, 2016

There are no duplicated extension loads in the files

@red-smeg

This comment has been minimized.

Copy link
Author

commented Oct 12, 2016

running on Ubuntu 16.04 with php 7.1, mysql 5.7, apache 2.4

Composer version 1.3-dev (aa051ba) 2016-10-12 14:57:43

@red-smeg

This comment has been minimized.

Copy link
Author

commented Oct 12, 2016

Here is the config.yaml for a vagrant box using puphpet to spin up the VM

config.yaml.txt

@Seldaek

This comment has been minimized.

Copy link
Member

commented Oct 13, 2016

This looks like when php gets started by composer it doesn't use the same parameters as when you start it.. How do you run composer? Using an alias of some kind? Do you have any custom parameters to php?

@Seldaek Seldaek added the Support label Oct 13, 2016

@stof

This comment has been minimized.

Copy link
Contributor

commented Oct 13, 2016

@Seldaek I saw this issue as well. It is related to the disabling of xdebug by composer, when launching the Symfony scripts

@Seldaek

This comment has been minimized.

Copy link
Member

commented Oct 13, 2016

Ok, would be good to get a clear way to reproduce though. /cc @johnstevenson

@Seldaek Seldaek added Bug and removed Support labels Oct 13, 2016

@johnstevenson

This comment has been minimized.

Copy link
Member

commented Oct 13, 2016

@stof Any more info about your experience of this?

@stof

This comment has been minimized.

Copy link
Contributor

commented Oct 13, 2016

@Seldaek here are the steps to reproduce:

@red-smeg

This comment has been minimized.

Copy link
Author

commented Oct 13, 2016

I run it using composer install at the command line.

@Seldaek if you vagrant up the config.yaml i attached it is reproducible. drop the config.yaml on puphpet.com and then choose create archive it will give you the complete box to spin up via down load

@red-smeg

This comment has been minimized.

Copy link
Author

commented Oct 13, 2016

It looks like composer copies the existing php.ini config to /tmp/vagrant-composer.php.ini

@johnstevenson

This comment has been minimized.

Copy link
Member

commented Oct 13, 2016

@red-smeg Do you get all the Module not loaded warnings if you call composer --version?

@red-smeg

This comment has been minimized.

Copy link
Author

commented Oct 13, 2016

Nope

Sent from my iPhone

On Oct 13, 2016, at 11:01, John Stevenson notifications@github.com wrote:

@red-smeg Do you get all the Module not loaded warnings if you call composer --version?


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@alcohol

This comment has been minimized.

@alcohol

This comment has been minimized.

Copy link
Member

commented Oct 13, 2016

I wonder if it is using the Composer generated php.ini from the /tmp directory and the additional ini files from the conf.d directory.

@johnstevenson

This comment has been minimized.

Copy link
Member

commented Oct 13, 2016

@alcohol Spot on. I've just come to the same conclusion. I inserted some code to see what was being called:

ScriptHandler::executeCommand
PHP_INI_SCAN_DIR = false
cmd = '/usr/bin/php5.6' '--php-ini=/tmp/vagrant-composer-php.ini' 'bin/console' --ansi assets:install --symlink --relative 'web'

Note that PHP_INI_SCAN_DIR is not set anyway, I just wanted to see if I was buggering things up.

@red-smeg

This comment has been minimized.

Copy link
Author

commented Oct 13, 2016

there are several iterations of the problem during the later part of the composer install after packages are all loaded each of the clean up tasks generate the problem

@alcohol

This comment has been minimized.

Copy link
Member

commented Oct 14, 2016

@red-smeg yes we have identified the cause. We are working on a solution.

@johnstevenson

This comment has been minimized.

Copy link
Member

commented Oct 14, 2016

To illustrate what XdebugHandler does and the reason for this issue:

composer first process
    - xdebug enabled = true
    - loaded ini = /etc/php/5.6/cli/php.ini
    - scan dirs = /etc/php/5.6/cli/conf.d
    - PHP_INI_SCAN_DIR = false
    - COMPOSER_ALLOW_XDEBUG = false

    composer is restarting...

    composer second process
        - xdebug enabled = false
        - loaded ini = /tmp/vagrant-composer-php.ini
        - scan dirs = (none)
        - PHP_INI_SCAN_DIR = ''
        - COMPOSER_ALLOW_XDEBUG = 'internal'

        composer was restarted, reset env
        - PHP_INI_SCAN_DIR = false
        - COMPOSER_ALLOW_XDEBUG = false

        composer work...

Now when the scripts are run, ScriptHandler.php adds the current php.ini to the command line, which is the combined ini at /tmp/vagrant-composer-php.ini . However, this requires that additional directories (as defined by the --with-config-file-scan-dir compile option) are not scanned. But because PHP_INI_SCAN_DIR has been returned to its original value (ie removed), this happens anyway and results in the already-loaded warnings.

The XdebugHandler behaviour is correct (although this scenario will need documenting), and the problem needs to be solved in ScriptHandler.php (I'm curious why the ini is included in the command-line anyway when Symfony's own PhpProcess doesn't do this).

Edit To clarify behavior is correct: not resetting PHP_INI_SCAN_DIR was my mistake and the cause of #5667. Seeing as this is all basically a hack, correct behavior is probably to get things back to where calls to php within a composer process will work for the most common use case (which is probably not specifying an ini file on the command-line).

@dvapelnik

This comment has been minimized.

Copy link

commented Oct 28, 2016

Now with last stable version all is correct
Composer version 1.2.1 2016-09-12 11:27:19
Try to composer self-update. It works for me

@curry684

This comment has been minimized.

Copy link
Contributor

commented Oct 28, 2016

That's not too surprising as current stable and preview builds do not have the Xdebug handler yet. That one's only in snapshot channel thus far.

@red-smeg

This comment has been minimized.

Copy link
Author

commented Oct 28, 2016

Did the self-update and it clears the problem !!

@Seldaek

This comment has been minimized.

Copy link
Member

commented Dec 6, 2016

What's the state here, I think that sensio script handler still has to be fixed to work with composer 1.3 right? Anything else we can do here or shall I close?

@johnstevenson

This comment has been minimized.

Copy link
Member

commented Dec 6, 2016

Yup, the Sensio script handler needs to be fixed.

This could be as simple as removing these lines:

    if (false !== $ini = php_ini_loaded_file()) {
        $arguments[] = '--php-ini='.$ini;
    }

However, presuming that using the loaded ini was added for a reason (?), it may be necessary to first check the COMPOSER_ORIGINAL_INIS environment variable and use the first value from its PATH_SEPARATOR separated list. Something like this:

    if ($env = strval(getenv('COMPOSER_ORIGINAL_INIS'))) {
        $paths = explode(PATH_SEPARATOR, $env);
        $ini = array_shift($paths);
    } else {
        $ini = php_ini_loaded_file();  
    }

    if (!empty($ini)) {
        $arguments[] = '--php-ini='.$ini;
    } 
@Seldaek

This comment has been minimized.

Copy link
Member

commented Dec 30, 2016

Closing, see sensiolabs/SensioDistributionBundle#299 to keep track of this.

@Seldaek Seldaek closed this Dec 30, 2016

@gondo

This comment has been minimized.

Copy link

commented Dec 30, 2016

is there any temporary fix to prevent this?

@johnstevenson

This comment has been minimized.

Copy link
Member

commented Dec 30, 2016

@gondo You can use an environment variable to bypass the restart: COMPOSER_ALLOW_XDEBUG=1

@BPScott

This comment has been minimized.

Copy link

commented Jan 4, 2017

For those that find this via search: This issue in SensioDistributionBundle is fixed as of version v5.0.17. Runcomposer update sensio/distribution-bundle to get the newest version.

@Glideh

This comment has been minimized.

Copy link

commented Oct 31, 2017

Still not working here

$ composer show sensio/distribution-bundle
[...] versions : * v5.0.21 [...]

$ composer -v
[...] Composer version 1.5.2 2017-09-11 16:59:25 [...]

$ composer install
[...] PHP Warning:  Module 'xxx' already loaded in Unknown on line 0 [...]

This works for me (but not very handy nor recommended I guess):

$ COMPOSER_ALLOW_XDEBUG=1 composer install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
10 participants
You can’t perform that action at this time.