Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Problem running gpm

Started by Muut Archive 11 years ago · 27 replies · 1036 views
11 years ago

Hello,

Even though I have the latest PHP version:
--------------------- $ php -v PHP 5.6.10 (cli) (built: Jun 18 2015 07:19:18) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies with Suhosin v0.9.38, Copyright (c) 2007-2015, by SektionEins GmbH ---------------------
I have problem running the gpm:
---------------------```
$bin/gpm selfupgrade

Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in /CENSORED/htdocs/bin/gpm on line 13
---------------------```

I have tried adding the following to .htaccess but this did not fix anything:
--------------------- AddType x-mapp-php6 .php AddHandler x-mapp-php6 .php ---------------------

This is my httpd.conf part in relation to PHP:
--------------------- <IfModule fastcgi_module> AddHandler php5-fcgi .php Action php5-fcgi /fcgi-bin/php5.external Alias /fcgi-bin/php5.external /php5.external FastCgiExternalServer /php5.external -socket /CENSORED/sockets/php5-fpm.socket -appConnTimeout 30 -idle-timeout 60 <Location /fcgi-bin/php5.external> Order Deny,Allow Deny from All Allow from env=REDIRECT_STATUS </Location> </IfModule> ---------------------

My .bash_profile:
--------------------- export PHP_PATH="/LATEST-PHP/bin/php" export PATH alias php="/LATEST-PHP/bin/php" ---------------------

Would you please help me fix this issue?

Thank you!

11 years ago

I have fixed the above error. My PATH environment was messed up.

Though now I have the following error when running gpm:

----------------------```
$ bin/gpm selfupgrade

[Whoops\Exception\ErrorException]
curl_init() expects parameter 1 to be string, array given

self-upgrade [-f|--force] [-y|--all-yes]
----------------------```

Would you please assist with this one!

Thank you!

11 years ago

This page suggests to check whether openssl is enabled:
https://muut.com/i/getgrav/general:gpm-issue

phpinfo() does confirm that openssl is enabled:
-------- OpenSSL support enabled OpenSSL Library Version OpenSSL 1.0.2c 12 Jun 2015 OpenSSL Header Version OpenSSL 1.0.2c 12 Jun 2015 --------

Have no idea what else can be done to fix that.

11 years ago

Can you please ensure that the PHP you are using from the command line is 5.4 or above?

BASH
$ php -v

Should be enough to tell you

11 years ago

Hello,

This requirements is met:
--------```
$ php -v
PHP 5.6.10 (cli) (built: Jun 18 2015 07:19:18)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, by Zend Technologies
with Suhosin v0.9.38, Copyright (c) 2007-2015, by SektionEins GmbH

11 years ago

Ok, other thing is can you test curl version?

BASH
$ curl -V
curl 7.37.1 (x86_64-apple-darwin14.0) libcurl/7.37.1 SecureTransport zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IPv6 Largefile NTLM NTLM_WB SSL libz
11 years ago

The output is as follows:
------```
$ curl -V
curl 7.43.0 (x86_64-unknown-linux-gnu) libcurl/7.43.0 OpenSSL/1.0.1e zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: IDN IPv6 Largefile NTLM NTLM_WB SSL libz UnixSockets

11 years ago

its very strange.. your Curl version is good, and the PHP version is good. What about if you run a phpinfo();, what is the output from the Curl section?

11 years ago

phpinfo() reports the following:
----------- cURL support enabled cURL Information 7.43.0 Age 3 Features AsynchDNS No CharConv No Debug No GSS-Negotiate No IDN Yes IPv6 Yes krb4 No Largefile Yes libz Yes NTLM Yes NTLMWB Yes SPNEGO No SSL Yes SSPI No TLS-SRP No Protocols dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp Host x86_64-unknown-linux-gnu SSL Version OpenSSL/1.0.2c ZLib Version 1.2.3 libSSH Version libssh2/1.4.2 -----------
curl -V reports "OpenSSL/1.0.1e" and it's the shared version on the server, I suppose, but my local version is "OpenSSL/1.0.2c". Might this be an issue?

11 years ago

I don't think that's it to be honest. What version of Grav are you currently on?

BASH
bin/gpm version
11 years ago

Grav version is 0.9.28.
Sections from phpinfo():
----------```
mbstring

Multibyte Support enabled
Multibyte string engine libmbfl
HTTP input encoding translation disabled
libmbfl version 1.3.2
----------```

----------```
gd

GD Support enabled
GD Version bundled (2.1.0 compatible)
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.3.11
GIF Read Support enabled
GIF Create Support enabled
JPEG Support enabled
libJPEG Version 6b
PNG Support enabled
libPNG Version 1.2.49
WBMP Support enabled
XBM Support enabled
----------```

----------```
openssl

OpenSSL support enabled
OpenSSL Library Version OpenSSL 1.0.2c 12 Jun 2015
OpenSSL Header Version OpenSSL 1.0.2c 12 Jun 2015
----------```

Apache/2.2.29 (Unix) mod_ssl/2.2.29 OpenSSL/1.0.1e-fips DAV/2 mod_fastcgi/2.4.6

Loaded modules:
------------```
$ apachectl -M
Loaded Modules:
core_module (static)
mpm_worker_module (static)
http_module (static)
so_module (static)
authn_file_module (shared)
authn_dbm_module (shared)
authn_anon_module (shared)
authn_dbd_module (shared)
authn_default_module (shared)
authn_alias_module (shared)
authz_host_module (shared)
authz_groupfile_module (shared)
authz_user_module (shared)
authz_dbm_module (shared)
authz_owner_module (shared)
authnz_ldap_module (shared)
authz_default_module (shared)
auth_basic_module (shared)
auth_digest_module (shared)
file_cache_module (shared)
cache_module (shared) [REQUIRED BY GRAV]
disk_cache_module (shared)
mem_cache_module (shared)
dbd_module (shared)
dumpio_module (shared)
reqtimeout_module (shared)
ext_filter_module (shared)
include_module (shared)
filter_module (shared)
substitute_module (shared)
charset_lite_module (shared)
deflate_module (shared)
ldap_module (shared)
log_config_module (shared)
log_forensic_module (shared)
logio_module (shared)
env_module (shared)
mime_magic_module (shared)
cern_meta_module (shared)
expires_module (shared) [REQUIRED BY GRAV]
headers_module (shared) [REQUIRED BY GRAV]
ident_module (shared)
usertrack_module (shared)
unique_id_module (shared)
setenvif_module (shared)
version_module (shared)
proxy_module (shared)
proxy_connect_module (shared)
proxy_ftp_module (shared)
proxy_http_module (shared)
proxy_scgi_module (shared)
proxy_ajp_module (shared)
proxy_balancer_module (shared)
ssl_module (shared) [REQUIRED BY GRAV]
mime_module (shared)
dav_module (shared)
asis_module (shared)
info_module (shared)
cgid_module (shared)
dav_fs_module (shared)
dav_lock_module (shared)
vhost_alias_module (shared)
negotiation_module (shared)
dir_module (shared)
imagemap_module (shared)
actions_module (shared)
speling_module (shared)
alias_module (shared)
rewrite_module (shared) [REQUIRED BY GRAV]
fastcgi_module (shared)
Syntax OK

11 years ago

Ok all I can figure is that here is some probem with Curl and HTTPS/SSL specifically related to your CA or lack thereof on your curl/server setup.

The only place we use curl_init() is in the Grav/Common/GPM/Response.php class where we have:

PHP
$ch = curl_init($uri);

the $uri variable is an https URL for github.

This is a PHP setup issue really and to sort it, might require doing some simple PHP testing.

http://unitstep.net/blog/2009/05/05/using-curl-in-php-to-access-https-ssltls-protected-sites/

Can you look at this article, try the quickfix, if that works, then you can try the proper fix to your server.

11 years ago

Another thought occurs. that Curl init code is such:

PHP
    private static function getCurl()
    {
        $args     = func_get_args();
        $uri      = $args[0];
        $options  = $args[1];
        $callback = $args[2];

        $ch = curl_init($uri);
        curl_setopt_array($ch, $options['curl']);

        if ($callback) {
            curl_setopt_array(
                $ch,
                [
                    CURLOPT_NOPROGRESS       => false,
                    CURLOPT_PROGRESSFUNCTION => ['self', 'progress']
                ] 
            );
        }

        $response = curl_exec($ch);

        if ($errno = curl_errno($ch)) {
            $error_message = curl_strerror($errno);
            throw new \RuntimeException("cURL error ({$errno}):
 {$error_message}");
        }

        curl_close($ch);

        return $response;

As you can see the $uri varibale is based on $args[0]. Your error indicates this is an array, when it should be the string url of the github repo. Can you var_dump($uri) in that Response.php file and see what it displays?

11 years ago

I have added added the quick fix line to the Response.php so that it looks:
--------- } curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($ch); ---------
But there was no change. The same error still appeared.

I have added var_dump to the Response.php so that it looks:
------ private static function getCurl() { $args = func_get_args(); $uri = $args[0]; var_dump($uri); ------

And got the following output:
--------```
$ bin/gpm selfupgrade
array(3) {
[0]=>
string(38) "http://getgrav.org/downloads/grav.json"
[1]=>
array(2) {
["curl"]=>
array(6) {
[10016]=>
string(8) "Grav GPM"
[10018]=>
string(8) "Grav GPM"
[19913]=>
bool(true)
[52]=>
bool(true)
[13]=>
int(15)
[42]=>
bool(false)
}
["fopen"]=>
array(5) {
["method"]=>
string(3) "GET"
["user_agent"]=>
string(8) "Grav GPM"
["max_redirects"]=>
int(5)
["follow_location"]=>
int(1)
["timeout"]=>
int(15)
}
}
[2]=>
NULL
}

11 years ago

Well the first item of your array, ie the [0] element, is clearly a String. In fact it even looks 100% correct:

JS
[0]=> string(38) "http://getgrav.org/downloads/grav.json"

So it's not the code. Clearly a string is being passed to curl_init() but your error says that PHP thinks this is an array. I'm kinda stumped!

11 years ago

I had a similar problem running bin/gpm [xxxxx] or bin/grav [xxxxx] (using shared hosting on Namecheap). I got around it by running

$php bin/gpm selfupgrade

11 years ago

iainsgillis, I have tried running as you have suggested but the error did not go away. I am on WebFaction hosting, running latest PHP, Apache, cURL, OpenSSL built from source. Though all ssl transactions are being handled by the front-end nginx, which has a slightly older OpenSSL.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1332 9 years ago
Archive · by Muut Archive, 9 years ago
2 923 9 years ago
Archive · by Muut Archive, 9 years ago
2 4053 9 years ago
Archive · by Muut Archive, 9 years ago
1 2931 9 years ago
Archive · by Muut Archive, 9 years ago
3 1109 9 years ago