getgrav / grav

Modern, Crazy Fast, Ridiculously Easy and Amazingly Powerful Flat-File CMS powered by PHP, Markdown, Twig, and Symfony
https://getgrav.org
MIT License
14.58k stars 1.41k forks source link

cannot connect to the GPM #505

Closed rocandante closed 8 years ago

rocandante commented 8 years ago

Hi, I'm trying grav on my server. Apparently everything works fine but when I navigate in the admin repeatedly receive the message: cannot connect to the GPM. What does it mean? Am I missing something in the setup or configuration?

w00fz commented 8 years ago

Check if you have openssl php extension enabled, that is required

// Djamil Legato // From iPhone //

On Dec 5, 2015, at 18:24, Juan David Cardona notifications@github.com wrote:

Hi, I'm trying grav on my server. Apparently everything works fine but when I navigate in the admin repeatedly receive the message: cannot connect to the GPM. What does it mean? Am I missing something in the setup or configuration?

— Reply to this email directly or view it on GitHub.

superlou commented 8 years ago

I'm getting the same symptoms. According to /admin/info, I have OpenSSL support enabled with library version "OpenSSL 1.0.1f 6 Jan 2014". I started with the Notepad skeleton.

rhukster commented 8 years ago

Do you get the same error from the command line gpm command as the admin? Do you have any firewall in place? is your bin/gpm file set with executable permissions?

superlou commented 8 years ago

From ls -l, my permissions are:

-rwxrwxr-x 1 root www-data    1691 Dec  7 19:17 gpm

The command line gpm command works fine. Running bin/gpm list does not give the message. I don't believe I have a firewall in place. I do have UFW firewall running with the following configuration:

To                         Action      From
--                         ------      ----
22                         ALLOW       Anywhere
80/tcp                     ALLOW       Anywhere
1622/tcp                   ALLOW       Anywhere
22 (v6)                    ALLOW       Anywhere (v6)
80/tcp (v6)                ALLOW       Anywhere (v6)
1622/tcp (v6)              ALLOW       Anywhere (v6)
w00fz commented 8 years ago

Can you try bin/gpm index command [not list] and see if you get the plugins/themes listed without errors?

superlou commented 8 years ago

bin/gpm index runs without any warnings/errors. Successfully lists plugins and themes then provides some messages on how to install.

w00fz commented 8 years ago

Thanks, just making sure it's isolated to admin. It's kind of strange because Admin shares the same methods that are used by bin/gpm. Can you confirm you are running the same PHP on both web and cli ?

superlou commented 8 years ago

Running php -v from the command line as root gives:

PHP 5.5.9-1ubuntu4.14 (cli) (built: Oct 28 2015 01:34:46) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

On the Configuration/Info page, the first heading is "PHP Version 5.5.9-1ubuntu4.14." I agree it's pretty weird. Are there any Admin interface actions that won't work if it really isn't able to access gpm?

w00fz commented 8 years ago

The error "cannot connect to the GPM" is specific to accessing the GPM::$grav object that has all the data regarding Grav's updates. However there is no distinction between Admin and CLI, they both instantiate the same GPM class.

If you go in Plugins and Add [/admin/plugins/install], do you get the whole list of plugins available for installation?

Also perhaps you can try editing the file getgrav/grav/blob/develop/system/src/Grav/Common/GPM/GPM.php#L46 and throw a proper error (ie, var_dump($e); die;), in case it's failing there.

superlou commented 8 years ago

So, if I try to add a plugin (or theme), I get ErrorException (E_ERROR): Call to a member function filter() on a non-object. It's happening in plugins/admin/classes/admin.php lin 455:

    {
        $gpm = $this->gpm();

        if (!$gpm) {
            return;
        }

        return $local ? $gpm->getInstalledPlugins() : $gpm->getRepositoryPlugins()->filter(function (
            $package,
            $slug

Does that provide any insight, or should I try modifying GPM.php?

Edit: @rocandante, do you get the same error? I don't want to hijack your issue if we had similar initial symptoms but a different root cause.

w00fz commented 8 years ago

~~That error is not related, it's calling a method that is in Grav and hasn't been released yet, we need to get that out asap. The fact that you can list the plugins for installation means you are accessing GPM, it is only failing to get the updates for Grav itself and not the Themes or Plugins.~~

Actually that filter is supposed to work at this stage, even with Grav not released yet, so that means from admin you cannot access any of the GPM, not just Grav updates.

Please, edit the GPM.php file and try throwing an error, there must be something in there that your server doesn't like.

superlou commented 8 years ago

Sorry for the hand-holding. In that exception catch block, if I try var_dump($e), I only get a white page back. I tried turning on errors with ini_set('display_errors', 1); error_reporting(E_ALL); but that doesn't seem to have any effect. Is there somewhere in Grav that's hiding all PHP errors?

I also tried throwing an exception and making sure error display was on, but it just pops up a message bubble with the exception text.

superlou commented 8 years ago

I tried moving to the core+admin release, and I no longer receive the message. It seems to have something to do with the Notepad skeleton.

rhukster commented 8 years ago

That's pretty odd. I tried downloading the current notepad skeleton and tested GPM. All worked fine. I'll close this for now, please reopen if the issue reoccurs.

lid3rs commented 8 years ago

Hello. I am receiving the same error message. I did a clean install on VPS. Then checked out my GIT repo and started receiving this message.

flaviocopes commented 8 years ago

PHP has all curl and openssl installed? http://learn.getgrav.org/basics/requirements#php-requirements

cravussin commented 8 years ago

Hi, I've got the same issue (cannot connect to GPM, exception on the filter() function when trying to add plugins) with latest Grav + Admin package (downloaded today). Windows 7 with XAMPP V3.2.2 installed

flaviocopes commented 8 years ago

@cravussin the PHP requirements are matched?

cravussin commented 8 years ago

Yes PHP 5.6.15

flaviocopes commented 8 years ago

I mean curl, openssl, zip support http://learn.getgrav.org/basics/requirements#php-requirements

cravussin commented 8 years ago

Yes all requirements are met. Actually, OpenSSL was missing at first, I activated it in php.ini then restarted the apache server.

flaviocopes commented 8 years ago

Are plugins installed fine with the command-line utility? The problem is just in the admin, or also from there?

cravussin commented 8 years ago

I'm not under Cygwin so I cannot use the CLI. Is there another way to install a plugin?

flaviocopes commented 8 years ago

You can still download a plugin from http://getgrav.org/downloads/plugins, unzip and move the folder under user/plugins, e.g. user/plugins/form/

cravussin commented 8 years ago

I suspect I might been having permission issues, reinstalling from scratch right now

cravussin commented 8 years ago

Okay, so reinstalling XAMPP + Grav using only user permissions changed nothing, still the same issue.

I managed to install the instagram plugin manually.

osriccaton commented 8 years ago

I had a similar issue. Setting the permissions right and adding the folder grav folder in ubuntu to www-data solved it for me.

cravussin commented 8 years ago

I've installed XAMP as a user so everyhing in htdocs is writable. I think it's the Admin plugin.

rhukster commented 8 years ago

You should try installing GitBash, then trying the command line tools:

> /path/to/php.exe bin/gpm index

From the root of your Grav install. I doubt its GPM itself, or Grav Admin as many people have no problems. 99% sure it's a config/setup issue on your end.

cravussin commented 8 years ago

I'll try again on my Mac later today and let you know.

Envoyé depuis mon iPhone

Le 23 déc. 2015 à 16:33, Andy Miller notifications@github.com a écrit :

You should try installing GitBash, then trying the command line tools:

/path/to/php.exe bin/gpm index From the root of your Grav install. I doubt its GPM itself, or Grav Admin as many people have no problems. 99% sure it's a config/setup issue on your end.

— Reply to this email directly or view it on GitHub.

cravussin commented 8 years ago

So it works flawlessly on my mac with MAMP 3.5. So it must be a Windows XAMPP vanilla configuration issue I suppose.

rhukster commented 8 years ago

Most likely it's a missing PHP module (openssl, curl) or could be permissions, but that is less likely on windows.

cravussin commented 8 years ago

I'll try with MAMP for Windows today

cravussin commented 8 years ago

Same issue with MAMP 3.5 for windows. There must be a problem between the win32 ports of apache / php and the Admin plugin.

mrmlnc commented 8 years ago

Works fine on:

Corwin7 commented 8 years ago

This problem occurred on a new Grav site I just set up. It was fixed with a simple chown -R www-data:www-data /var/www/html/www.example.com

Endogen commented 8 years ago

I had the same issue on my CentOS server and the cause was that SELinux was enabled and it blocked the execution of gpm. On Cent you can disable SELinux with sudo setenforce Permissive. After that, i didn't get that error anymore. If someone is interested in reading about SELinux, go here. Link to the issue here on github

rhukster commented 8 years ago

We've added more informative errors that should help you with this going forward.

Gorcenski commented 8 years ago

I'm getting this error, too. Fresh Ubuntu 14.04 install, fresh install of Grav and the admin plugin. OpenSSL is enabled, curl is enabled, and permissions are configured. Any guidance on where to look for the source of the problem would be appreciated.

rhukster commented 8 years ago

Is it possible you are behind a proxy?

rhukster commented 8 years ago

The other thing to check is that curl and openssl are actually enabled in PHP for the CLI version:

$ php -i | grep curl
$ php -i | grep openssl

I'm assuming your resting bin/gpm from the command line. Best to try there first. Also what exactly si the error you are getting?

cravussin commented 8 years ago

I think you put the finger on the cause of my issue. I was having this problem at work where my station is behind a proxy.

Is there a way to configure gpm to go through a ntlmv2 authenticated proxy?

Le 10 janv. 2016 à 06:44, Andy Miller notifications@github.com a écrit :

Is it possible you are behind a proxy?

— Reply to this email directly or view it on GitHub.

Gorcenski commented 8 years ago

@rhukster Solved it. It ended up being an ownership issue after all with the www-data user in Ubuntu server. I had run the permissions configuration script on the Troubleshooting page, but I still needed to perform a chown -R... after installing some plugins manually. Thanks again for your help!

rhukster commented 8 years ago

No problem @Gorcenski , glad you got it sorted.

@cravussin check this comment out about how to set up some environment variables so Curl can use Proxy: https://github.com/getgrav/grav/issues/359#issuecomment-148369451

cravussin commented 8 years ago

@rhukster cool thanks for the tip!

happywky commented 8 years ago

I'm using xampp in mac to have a local test, The admin page pops up a bubble when: turn on the openssl : internal sever error turn off the openssl : Cannot connect to GPM //php -i | grep openssl

Configure Command => '/Library/Caches/com.apple.xbs/Binaries/apache_mod_php/apache_mod_php-101~18/Objects/php/configure' '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--sysconfdir=/private/etc' '--with-libdir=lib' '--enable-cli' '--with-iconv=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.Internal.sdk/usr' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/Library/Server/Web/Config/php' '--with-libxml-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.Internal.sdk/usr' '--with-openssl=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.Internal.sdk/usr/local openssl

rhukster commented 8 years ago

You certainly do need openssl turned on.

if you get an internal server error, then there's probably something missing in your openssl setup. The best way to find out what, is to look at your web server logs.

Quick question, is there a particular reason you are using xampp on a mac? The usual suspects are MAMP or the built-in Apache with homebrew. I've outlined detailed steps on using homebrew on a mac: https://getgrav.org/blog/mac-os-x-apache-setup-multiple-php-versions

I strongly recommend this approach if you are tech-savvy, else MAMP is a solid and reliable way and 'just works'.

arieedzig commented 8 years ago

Helo, after upgrading apache and using mod_ruid, the plugin and theme menu throw an error "Cannot connect to the GPM", I echo in Response.php and got error SSL peer certificate or SSH remote key was not OK, When I added this CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false, there were no more error. But I think this is not a good solution, because when I upgrade, those line will be overwritten. What should I do?

rhukster commented 8 years ago

I think your ssl library is out of date. Our cert is perfectly valid.

Cheers!

Andy Miller http://trilbymedia.com

On Aug 26, 2016, 21:33 -0600, arieedzig notifications@github.com, wrote:

Helo, after upgrading apache and using mod_ruid, the plugin and theme menu throw an error "Cannot connect to the GPM", I echo in Response.php and got error SSL peer certificate or SSH remote key was not OK, When I added this CURLOPT_SSL_VERIFYHOST => false, CURLOPT_SSL_VERIFYPEER => false, there were no more error. But I think this is not a good solution, because when I upgrade, those line will be overwritten. What should I do?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub (https://github.com/getgrav/grav/issues/505#issuecomment-242893085), or mute the thread (https://github.com/notifications/unsubscribe-auth/ABCNGazHvMVKsNkPi9Vtwuz0iOogOxp-ks5qj7AegaJpZM4GvkUZ).

rhukster commented 8 years ago

@arieedzig I have actually updated our Cert with one from LetsEncrypt, let me know if your issue remains??