Support » Developing with WordPress » Alternate way to install packages

  • Resolved rahilwazir

    (@rahilwazir)


    Reposting from #4729:
    So the server I’m trying to install a wp package has allow_url_fopen=0 thus I get the following error

    Error: The “https://wp-cli.org/package-index/packages.json” file could not be downloaded: allow_url_fopen must be enabled in php.ini (https:// wrapper is disabled in the server configuration by allow_url_fopen=0
    failed to open stream: no suitable wrapper could be found)

    I don’t have access to the primary php.ini file so I’ve created a user specific php.ini also enabling the option allow_url_fopen=1

    > export WP_CLI_PHP="/usr/local/bin/php -c /path/to/php.ini"
    > echo $WP_CLI_PHP
    /usr/local/bin/php -c /path/to/php.ini
    

    Re-login to the server and tried installing the package again, shows the same initial error. Is there any workaround or I am doing something wrong?

    WP-CLI: 1.5.0

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Try to add this code to your .htaccess file:

    php_value allow_url_fopen On

    If it doesn’t work, talk to your hosting tech support.

    Well yeah that didn’t work. Thanks.

    Hi @rahilwazir,

    Which WP-CLI installation method are you using?

    If you’re using the Phar installation method, the WP_CLI_PHP environment variable isn’t applicable. Instead, you can set allow_url_fopen=1 on the fly:

    
    php -d allow_url_fopen=1 wp-cli.phar
    

    If you’re using the Composer or Git installation method, can you verify your php.ini is loaded by executing wp --info?

    Hi @danielbachhuber

    I was able to installed the package successfully with your method php -d .... And Yes I’m using the Phar installation method.

    Thank you.

    Great, glad you were able to work it out.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Alternate way to install packages’ is closed to new replies.