Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while installing mongo driver for PHP on amazon linux

I tried to install the mongodb driver for PHP on Amazon Linux. While running sudo pecl install mongo, I get the error message:

fatal error: openssl/evp.h: No such file or directory
 #include <openssl/evp.h>
                         ^
compilation terminated.
make: *** [io_stream.lo] Error 1
ERROR: `make' failed

PEAR Version: 1.9.5 PHP Version: 5.3.29

I installed gcc which helped me progress further with the install till this error.

The best Guide I was able to find was here: http://jonathanhui.com/install-mongodb-amazon-linux PHP's guide: http://php.net/manual/en/mongo.installation.php

like image 246
Chris Michaels Avatar asked Mar 25 '15 17:03

Chris Michaels


People also ask

What is MongoDB PHP driver?

MongoDB driver ¶It provides a minimal API for core driver functionality: commands, queries, writes, connection management, and BSON serialization. Userland PHP libraries that depend on this extension may provide higher level APIs, such as query builders, individual command helper methods, and GridFS.

Does PHP support MongoDB?

You can add the driver to your application to work with MongoDB in PHP. The MongoDB PHP Driver consists of the two following components: The extension , which provides a low-level API and mainly serves to integrate libmongoc and libbson with PHP.


2 Answers

evp is high-level cryptographic functions.

Try to install development libraries:

Ubuntu: sudo apt-get install libssl-dev

CentOS: yum install openssl-devel

like image 71
Vor Avatar answered Oct 19 '22 11:10

Vor


The right package to install is not libssl-dev but

sudo apt-get install pkg-config

and now you can execute

sudo pecl install mongodb

Don't forget to add extension=mongodb.so to your php.ini file.

To know which php.ini file is loaded you can create and simple php file on vps

<?php
   php_info()
?>

Example directory php.ini in phpinfo()

like image 22
Sum_Pie Avatar answered Oct 19 '22 11:10

Sum_Pie