2013-07-17 25 views
0

我在與openssl_x509_parse()函數經與openssl_x509_parse()函數

$parsed_cert = openssl_x509_parse(file_get_contents('/home/my_location/aaa010101aaa__csd_01.cer')); 

函數返回一個錯誤,我不能確定的原因煩。也許證書文件必須在.pem.crt

編輯: 代碼是好的,但文件的格式是問題,所以我不得不將其轉換成.cer原始.crt文件的格式。

回答

0

看到manual page的例子後,你的代碼看起來很好。問題可能在file_get_contents中。

請嘗試以下操作並檢查文件是否有效。

$file = file_get_contents('/home/my_location/aaa010101aaa__csd_01.cer'); 
$parsed_cert = openssl_x509_parse($file); 

現在檢查文件是什麼。它是否存在或有效的證書文件?