Error while installing mongo driver for PHP on amazon linux - php

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

evp is high-level cryptographic functions.
Try to install development libraries:
Ubuntu:
sudo apt-get install libssl-dev
CentOS:
yum install openssl-devel

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()

Related

Error 1 ERROR: `make' failed when installing sqlsrv

I'm trying to install sqlsrv by using the commands from this page. However, when running
pecl install sqlsrv-4.2.0preview
I get the error: Error 1 ERROR: 'make' failed.
I tried :
apt-get update
apt-get install build-essential
apt-get install libpcre3-dev
apt-get install make
All of these are installed on the latest version.
I'm running a container using the php:7.0-apache image. Running apachectl -V returns Apache/2.4.10 (Debian).
Here is the full log output from the command I ran: https://pastebin.com/MYDY3xwU
I had this exact error.
/tmp/pear/temp/sqlsrv/shared/xplat.h:30:17: fatal error: sql.h: No such file or directory
#include <sql.h>
Apparently the header file its looking for is only in the package unixODBC-devel.
I installed that package and was able to successfully complete the build. yum install unixODBC-devel.
Possibly, a better explanation is here.
stackoverflow Question # 15447386
I had the following error on Ubuntu 18.04 when installing
/tmp/pear/temp/sqlsrv/shared/xplat.h:30:10: fatal error: sql.h: No such file or directory #include <sql.h>
Installing the package unixodbc-dev as Matthew Goheen proposed solved the issue
sudo apt-get install unixodbc-dev
try
sudo apt-get install unixodbc-dev

Docker PHP5.6 Call to undefined function bindtextdomain()

Problem:
I have a Docker compose with an nginx service and a PHP service.
When I try to open a page of my dev project, I encounter this error:
Fatal error: Call to undefined function bindtextdomain() in /usr/share/nginx/html/some_project/some_path/Bootstrap.php on line 16
I saw that is a problem of a missing dependency: php-gettext.
My configuration:
In my Dockerfile, I try to install it:
FROM php:5.6.30-fpm
MAINTAINER DarckCrystale "xxx#xxx.xx"
# Here I try to install the php-gettext extension
# but it does not work
RUN apt-get update && apt-get install -y php-gettext gettext
# Setup PHP configuration
ADD php.ini /usr/local/etc/php/conf.d/php.ini
In my php.ini, I load it:
extension=gettext.so
Other information:
When I run in my container
php -i | grep extension_dir
I have this message displayed:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20131226/gettext.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20131226/gettext.so: cannot open shared object file: No such file or directory in Unknown on line 0
What it seems to be to me:
I think
RUN apt-get update && apt-get install -y php-gettext gettext
does not install the php-gettext extension. I don't know why. I think this is a PHP Dockerized specific problem.
So, after struggle, I finally found how to install this extension in the PHP container!
How to solve this problem?
Use docker-php-ext-install instead of apt-get install in the Dockerfile:
FROM php:5.6.30-fpm
MAINTAINER DarckCrystale "xxx#xxx.xx"
# Here I install the php-gettext extension
# and it works! :D
RUN docker-php-ext-install gettext
# Setup PHP configuration
ADD php.ini /usr/local/etc/php/conf.d/php.ini
What is the problem?
PHP container have a specific way to install PHP extensions:
How to install more PHP extensions
We provide the helper scripts docker-php-ext-configure, docker-php-ext-install, and docker-php-ext-enable to more easily install PHP extensions.
So php-gettext extension installation seems to work only using provided scripts.

How to install V8js on PHP5.5?

I want to install the v8js extension for PHP5.5 on Ubuntu 12.04 but can't make it working.
When I try to install the v8js extension version 0.2.0 (latest) with PECL, I have this message:
configure: error: libv8 must be version 3.24.6 or greater
ERROR: `/tmp/pear/temp/v8js/configure --with-v8js' failed
If I try to install an old version, I have a compilation error. This message is very similar to my issue: Install v8js for php on ubuntu
How can I fix this issue?
EDIT: I couldn't install it on Ubuntu 14.04 with PHP5.5, even with a PHP downgrade with PHPbrew to PHP 5.4. However, using Ubuntu 12.04 with PHP 5.4 works great. I didn't try the downgrade from PHP 5.5 to 5.4 on Ubuntu 12.04.
in case you can't find libv8-dev or libv8-dbg, you can find the correct version by run command
~$ apt-cache search libv8
libv8-3.14-dbg - V8 JavaScript engine - debugging symbols
libv8-3.14-dev - V8 JavaScript engine - development files for 3.14 branch
libv8-3.14.5 - V8 JavaScript engine - runtime library
libv8-dev - V8 JavaScript engine - development files for latest branch
then you can run
~$ sudo apt-get install libv8-3.14-dev libv8-3.14-dbg g++ cpp
then you can try to install v8js via pecl by running
~$ sudo pecl install v8js-0.2.0
if that command return error like this
configure: error: libv8 must be version 3.24.6 or greater
ERROR: `/tmp/pear/temp/v8js/configure --with-v8js' failed
you can try to install v8js-0.1.3 instead by running
~$ sudo pecl install v8js-0.1.3
then edit your php.ini to add v8js extension
~$ echo "extension=v8js.so" >> /etc/php5/cli/php.ini
Open your terminal/console
sudo apt-get install libv8-dev libv8-dbg g++ cpp
Make an update sudo apt-get update
Try sudo pecl install v8js-0.2.0 (or other version i.e.: sudo pecl install v8js-0.1.3)
Edit your php.ini (Check: Where is my php.ini file?) file by adding: extension=v8js.so.
Restart server
If it the extension still doesn't work, try to edit /etc/php5/conf.d/v8js.ini and add extension=v8js.so and restart server again.
Hope this helps.
These other answers work well and I used v8js-0.1.3 for the past 1.5 years but after needing to upgrade to PHP 7 I needed a better solution as v0.1.3 doesn't compile with PHP 7 (something to do with php_smart_str being renamed to php_smart_string).
After a couple hours of frustrating research and compiling libv8 myself, I didn't want to have to go through this whole process on every server I provisioned.
Anyway, I found this site which points you to a launchpad PPA site that provides a couple different ubuntu packages with the 5.1 and 5.2 libv8 libraries.
I ran these commands (please don't add repositories of 3rd party devs without understanding the risks).
sudo apt-add-repository ppa:pinepain/libv8-5.2
sudo apt-get update
sudo apt-get install libv8-5.2-dev
sudo pecl install v8js-1.1.0
(Thanks #JeyKeu for suggesting to add "apt-get update" to these commands)
I couldn't get v8js-1.3.0 or 1.2.0 to build, but 1.1.0 worked well. I checked the changelog and found that the latest updates are not necessary in my circumstance anyway.

Installing xattr PECL extension in Ubuntu 12.10

I am trying to install extension xattr in my Ubuntu 12.10 .
sudo pecl install xattr
But I am getting the error as :
checking for xattr files in default path... not found
configure: error: Please reinstall the libattr distribution
ERROR: `/tmp/pear/temp/xattr/configure --with-xattr' failed
How do I correct this error and install xattr in LAMP ?
This did the trick for me:
sudo apt-get install libattr1-dev
Then simply rerun the "sudo pecl install xattr" command and you should be set.

PHP extension install - phpize error - on NGINX/PHP-FPM

I want to install imagick extension for PHP. But i get error 'phpize' error when installing
> pecl install imagick-3.1.2
downloading imagick-3.1.2.tgz ...
Starting to download imagick-3.1.2.tgz (94,657 bytes)
.....................done: 94,657 bytes
15 source files, building
running: phpize
sh: phpize: command not found
ERROR: `phpize' failed
I know php-devel package contains phpize for compiling/creating modules/extensions. I don't want to install apache. I am running a LEMP on CentOS 6.4
How do i proceed? or install phpize without apache and reinstalling/configuring php
as root, execute the following command
yum install php-devel
Then try installing the imageMagick extension again
Install the php-devel package, it's included in there

Categories