Trouble installing Composer on IBMi

General discussion on Zend Server for IBM System i
Post Reply
tom8588
Posts: 4
Joined: Fri Sep 04, 2015 2:08 pm

Trouble installing Composer on IBMi

Post by tom8588 » Fri Sep 04, 2015 3:48 pm

NOTE*: I had to add '+' between the domain names and TLD of each link in this post.

I'm having difficulties installing composer on IBMi. I'm new to AS400 and even composer so I don't want to just go ahead and start making changes blindly without knowing the potential ramifications. I'm more or less going to describe the potential solutions I found on the Internet and hope someone can confirm one of these methods actually apply to and fix the issue.

Composer is failing on the https connection judging from the results of

Code: Select all

$
php-cli composer.phar diagnose                                               
Checking platform settings: OK                                               
Checking git settings: OK                                                    
Checking http connectivity to packagist: OK                                  
Checking https connectivity to packagist: FAIL                               
[Composer\Downloader\TransportException] The "https://packagist+.+org/packages.json" file could not be downloaded: SSL operation failed with code 1. 
OpenSSL Error messages:                                                             
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed                                                                         
Failed to enable crypto                                                      
failed to open stream: operation failed                                      
Checking github+.+com rate limit: FAIL                                         
[Composer\Downloader\TransportException] The "https://api.github+.+com/rate_limit" file could not be downloaded: SSL operation failed with code 1. 
OpenSSL Error messages:                                                               
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed                                                                         
Failed to enable crypto                                                      
failed to open stream: operation failed
Checking disk free space: FAIL                                               
The disk hosting /PATH/TO/WEBROOT/vendor is full                                                                         
Checking composer version:                                     
  [Composer\Downloader\TransportException]                                   
  The "https://getcomposer+.+org/version" file could not be downloaded: SSL operation failed with code 1. 
OpenSSL Error messages:                           
  error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed                                                                       
  Failed to enable crypto                                         
  failed to open stream: operation failed
diagnose                                              
$                                                                             
I've found similar issues for OS X systems, but their paths are different and the solutions don't seem to match up to what I have on my system.
[url]https://github+.+com/composer/composer/issues/3045[/url]
and
[url]http://akrabat+.+com/ssl-certificate-verification-on-php-5-6/[/url]


What I gather from these two articles is I need to use the "default_cert_dir" value from

Code: Select all

var_dump(openssl_get_cert_locations());
and then run from the command line:

Code: Select all

export SSL_CERT_DIR=/using/the/value/from/default_cert_dir
OR alternatively I can just set the php directive to my CA cert.pem file by adding this to my php.ini:

Code: Select all

openssl.cafile=/usr/local/etc/openssl/cert.pem
The only thing I'm unsure about with this method is that I don't know where my CA's .pem file is.
I'm hesitant to run a grep on the entire file system because it will take up a decent amount of resources.
Does anyone know of where these .pem files are located, or at least of a method which reports the path other than a grep on the entire filesystem?

Also, I don't know if this is relevant, but my openssl header and library versions do not match up.

Code: Select all

SSL Version => OpenSSL/1.0.1p                       
openssl                                             
OpenSSL support => enabled                          
OpenSSL Library Version => OpenSSL new.version.of.openssl 01 Jan 2015
OpenSSL Header Version => OpenSSL old.version.of.openssl 01 Jan 2001
openssl.cafile => no value => no value              
openssl.capath => no value => no value              
OpenSSL support => enabled                          
$                                                   
This question suggests rebuilding apache: [url]http://stackoverflow+.+com/questions/11495034/why-does-phpinfo-have-a-header-version-and-library-version-what-are-the-differe[/url]
This forum question suggests rebuilding PHP: [url]http://board.phpbuilder+.+com/showthread.php?10382147-RESOLVED-OpenSSL-Library-Version-does-not-match-OpenSSL-Header-Version[/url]

I've never built either from source, so I'm hesitant to follow these instructions since neither are IBMi specifc nor are they definitely the issue.
Is it even wise to attempt to rebuild PHP or Apache on your own when using Zend Server for IBMi? The SSL header version is vastly out of date, I'm not sure how Zend Server updates work, but how does something like this go so long without being updated? Is the only method to recompile PHP on our own?

timo_karvinen
Posts: 82
Joined: Wed Aug 12, 2009 7:58 am
Location: Tampere, Finland
Contact:

Re: Trouble installing Composer on IBMi

Post by timo_karvinen » Tue Sep 08, 2015 9:06 am

Hi.

PHP is kind of funny like that, it doesn't come bundled with root certificate file (at least the i variety, I'm not entirely sure about others).
So you have to get your root certificate file separately, pretty common way is to go with Mozilla root certificate bundle.
You can find the file and the instructions by googling something like "php ssl curl" or so.

-Timo

tom8588
Posts: 4
Joined: Fri Sep 04, 2015 2:08 pm

Re: Trouble installing Composer on IBMi

Post by tom8588 » Tue Sep 08, 2015 4:21 pm

Thank you Timo, I managed to find a cert.pem file from [url]http://curl.haxx+.+se/ca/cacert.pem[/url]
All I had to do was place this file in the same directory as the reported value for "default_cert_dir" when dumping the values from

Code: Select all

openssl_get_cert_locations()
There are still some other issues I have to take care of, but they are specific to my server configuration.

tom8588
Posts: 4
Joined: Fri Sep 04, 2015 2:08 pm

Re: Trouble installing Composer on IBMi

Post by tom8588 » Wed Sep 09, 2015 5:59 pm

I made a mistake in my previous post. It has to be located where ever the "default_cert_file" value is. Named the same and all.
Alternatively you could just change the value of "default_cert_file" to where ever you want.
I didn't bother looking into how to do this though, so I can't post first hand instructions here.

From what I found, IBMi doesn't use the .pem extension which is required for CURL. So I don't think it is possible to use the same system CA cert for CURL as you do for the AS400.

Post Reply