GPM error: Invalid argument supplied for foreach()


I’d like to ask for assiatance with the followig error:

$ bin/gpm install mediator

Invalid argument supplied for foreach()

At first, when trying to install the theme, I got the error:

--------[RuntimeException] Error while trying to download '' --------

I got rid off this error by creating directory /home/username/.grav/config, which was mentioned in yet another error below that I fixed with php.ini edit:

--------[Whoops\Exception\ErrorException] file_exists(): open_basedir restriction in effect. --------

Would you please advise how to get through the “Invalid argument supplied for foreach()” error ?

Thank you!

what version of grav are you on?

It is version 0.9.29.

Ok, I just tested and it works fine on my local. So it’s not the mediator theme specifically:

~/workspace/grav 3 $ bin/gpm install mediator

Please select installation method for Mediator (GPM is default)
  [0] GPM
  [1] Symlink
 > 0

Preparing to install Mediator [v1.0.3]
  |- Downloading package...   100%
  |- Checking destination...  ok
  |- Installing package...    ok
  '- Success!

Clearing cache

Cleared:  cache/compiled/*
Touched: /Users/rhuk/workspace/grav 3/user/config/system.yaml

By default, GPM expects to use github tarballs to install. The option to install by symlink is for development only. You creating a .grav/config file is what triggers the symlink option, and unless you have that setup 100% correct, will cause that error you are seeing.

The fundamental problem is that you are unable to access those tarballs. So:

  1. Delete your .grav/config file, that is only causing more problems
  2. Ensure you have all the Grav PHP pre-requisites.

Most likely you are missing Curl or OpenSSL setup with your PHP install. You can run:

$ php -i

and put that output in a gist or some other readable text file, and we can examine that to see what you have installed and what’s missing.

I have made available PHP information here.

Nothing jumps out at me there. Assuming you have now removed the .grav/config file, what happens when you do a bin/gpm index ? What about bin/gpm install mediator ?

I have removed “.grav/config” and running “bin/gpm index” gives me a list of plugins and themes, no errors.

When running “bin/gpm install mediator” I get the following error:
$ bin/gpm install mediator

Preparing to install Mediator [v1.0.3]
|- Downloading package… 0%

Error while trying to download ‘

install [-f|–force] [-y|–all-yes] [-d|–destination [DESTINATION]] [–] ()…

Instead of running the PHP that was built by me from source, I have switched to the PHP provided by my host and now the error does not appear.

Sweet, so all working now?

Yes, everything is fine now, thank you!