Iron.io Workers PHP error Class 'PDO' not found - php

I've got this error when launching a php worker on Iron.io :
PHP Fatal error: Class 'PDO' not found in /mnt/task/...
My PHP script just call the native PDO extension like this :
$db = new PDO (...);
Anybody know if there's a known problem with the docker image iron/php and the PDO extension ?
Thank you.

Try to add php-pdo package into your docker image.
Example of installing php-pdo package via Dockerfile:
FROM iron/php
...
RUN apk add php-pdo
...

Related

Issue with install and setup mongodb into m1 macbook

I have an issue with connecting php(valet) and MongoDB. I tried to install MongoDB with pecl and command sudo pecl install mongodb and brew install mongodb and all time I get some errors during the install process:
In file included from /private/tmp/pear/temp/mongodb/src/MongoDB/Cursor.c:18: /opt/homebrew/Cellar/php#8.0/8.0.17/include/php/ext/spl/spl_iterators.h:151:4: error: unknown type name 'pcre_cache_entry' pcre_cache_entry *pce; ^ 1 error generated. make: *** [src/MongoDB/Cursor.lo] Error 1 ERROR: make' failed`.
But when I run mongo --version I get:
and I install MongoDB Compass and as you can see, I can connect to the database and write into it:
But when I try out to install laravel package jenssegers/mongodb I get these errors: I tried with --ignore-platform-req=ext-mongodb flag but then it install package but it didn't work, I get this error: Error: Class "MongoDB\Driver\Manager" not found.
Finally, I find out a great package that helps me in this! This repo saves me a ton of time and debugging! Thank you shivammathur!
Hey I also had the same problem. A good alternative is to also follow with this article if you want to stick with pecl https://freek.dev/2151-fixing-the-dreaded-pcre2h-file-not-found-error-when-installing-imagick

How to force Symfony 3 to use Memcached instead of Memcache class

I am running php7 on debian and I do only have the php7-memcached extension available since php-memcache appears to be deprecated or not compatible with php7.
When I run my Symfony 3.2.8 setup with composer some post-install-cmd's are executed like
Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache
Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets
For some reason they require the memcache extension instead of the memcached extension which is installed and loaded with the php cli. So the execution results in the follow error:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Memcache' not found
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets handling the symfony-scripts event terminated with an exception
[RuntimeException]
An error occurred when executing the "'assets:install --symlink --relative '\''web'\'''" command:
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Memcache' not found
Is there any way to make Symfony use the Memcached class of the available extension instead of the Memcache class? I've checked some app configurations which specify Memcache as class and modified them to Memcached without success. I couldn't find a configuration which might be related to the Debug Component specified in the exception.

Class MongoDB\Driver\Query' not found, MongoDB installed

For this installation:
Nginx 1.11.10
Yii Framework 2.0.12 ("yiisoft/yii2-mongodb": "^2.0")
PHP MongoDB library (mongodb 1.2.9, compatible with PHP Version: PHP 5.4.0 or newer)
PHP 5.4.16
Plesk Onyx 17.0.17
No IPTables rules
Strangely enough they function when you visit the website the first time. I can also see data pulled from the Mongo database. But when visiting another page within 10-20 seconds, this error will appear:
25403#0: *170 FastCGI sent in stderr: "PHP message: PHP Fatal error: Class 'MongoDB\Driver\Query' not found in /var/www/vhosts/website.com/website.com/vendor/yiisoft/yii2-mongodb/Command.php on line 284" while reading response header from upstream
PHP Fatal Error – yii\base\ErrorException
Class 'MongoDB\Driver\Query' not found
1. in /var/www/vhosts/website.com/website.com/vendor/yiisoft/yii2-mongodb/Command.php at line 284
try {
$this->beginProfile($token, __METHOD__);
$query = new \MongoDB\Driver\Query($this->document, $options);
However, if you wait another 10-20 seconds, the website works just fine.
I solved it in a yii2 docker alpine nginx image, doing this:
FROM local/dmstr/php-yii2:latest-alpine-nginx
RUN apk --update add autoconf g++ make && \
pecl install mongodb
RUN echo "extension=mongodb.so" > /usr/local/etc/php/conf.d/docker-php-ext-mongodb.ini
You must install mongodb and then create an ini file for the extension on your system's php extensions directory, like I did. Remember to put extension=mongodb.so on it.

Mongo DB php driver fatal error

I want to use Mongo DB with php, so for that I have installed the driver and its showing here as well in phpinfo()
The problem is when I try to connect it, I get Fatal error.
Fatal error: Uncaught Error: Class 'MongoDB\Client' not found
Here is how I am connecting
$mongo = new \MongoDB\Client('mongodb://user:xxx!#00.00.00.00/chat');
try
{
$dbs = $mongo->listDatabases();
print_r($dbs);
}
Here is how I installed extension sudo apt-get install php7.0-mongodb
Also I followed this http://php.net/manual/en/mongodb.tutorial.library.php
Any help!
\MongoDB\Client belongs to the mongo-php-library which is different from mongo-php-driver
in another words, the library is using the driver,
so after installing the mongo-php-driver you need to perform another operation by installing the library using composer
composer require mongodb/mongodb
or even by cloning it from github
git clone https://github.com/mongodb/mongo-php-library.git

CouchBase class not found in laravel5

I use couchbase nosql database by ytake/laravel-couchbase package in my laravel 5.1 project
After install that package and run php artisan serve i got error :
PHP Fatal error: Class 'CouchbaseN1qlQuery' not found in /var/www/html/eee/vendor/ytake/laravel-couchbase/src/CouchbaseServiceProvider.php on line 71
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'CouchbaseN1qlQuery' not found
I had this error for a long time.
For me, the problem was that the CLI user couldn't write in the laravel.log when the couchbase client was trying to write a warning to it. Check user permissions.

Categories