I install aws sdk for php in my elastic beanstalk application using phar file,:
require_once __DIR__ . '/../AWS-SDK/aws.phar';
when I run the script for the first time, it succeed ! but when I try again I got this error :
Warning: require(phar://aws.phar/aws-autoloader.php): failed to open stream: phar error: invalid url or non-existent phar "phar://aws.phar/aws-autoloader.php" in /var/app/current/src/utils/AWS-SDK/aws.phar on line 3 Fatal error: require(): Failed opening required 'phar://aws.phar/aws-autoloader.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/app/current/src/utils/AWS-SDK/aws.phar on line 3
How to solve the problem ?
Don't use require_once. That's causing that issue. You should use require or include
There seems to be an error on some versions of the aws.phar file that causes this behavior and warning message.
Warning: require(phar://aws.phar/aws-autoloader.php): failed to open stream: phar error: invalid url or non-existent phar "phar://aws.phar/aws-autoloader.php" in /var/app/current/src/utils/AWS-SDK/aws.phar on line 3 Fatal error: require(): Failed opening required 'phar://aws.phar/aws-autoloader.php' (include_path='.:/usr/share/pear:/usr/share/php')
I was experimenting the same issue using aws.phar with version 2.7.17 of the AWS SDK for PHP
The solution that worked for me was to download and extract the aws.zip version of the AWS SDK for PHP and require aws-autoloader.php instead as described in the installation docs.
http://docs.aws.amazon.com/aws-sdk-php/guide/latest/installation.html#installing-via-zip
Some people reports success when using the 2.4.10 version of the AWS (aws.phar) but that is too old for my purposes.
https://pyd.io/f/topic/pydio-6-0-s3-plugin-phar-error/
Try turning off opcache
add the following to /etc/php5/apache2/php.ini opcache.enable=0
restart apache service apache2 restart
This is a know issue at least with older versions of the aws.phar and there seems to be a general issue with phars and opc (formerly Zend Optimizer+)
to solve the problem I'v installed the sdk using composer ! BTW it's the recommended technique !
Make sure you declare all namespace usage at the top of the file before you do "require". If you include files first, it can mess up the namespacing. This fixed the issue for me.
Related
We encounter a very strange error after deploying our application to production.
It seems like a typo in package name (Docsrine vs Doctrine) and it's not always the same package that seems to be broken. The correct version of the file mentioned in the error exists at the correct path (the one with Doctrine).
The cases we found only present in doctrine/mongo stuff.
We experience this with php 7.0.13 and 7.2.5. pecl-mongodb versions 1.2.10 and 1.4.3.
A restart of the fpm seems to resolve the problem (no
te that we also do a restart immediately after deploy, but with no success).
2018/05/07 18:35:15 [error] 4749#4749: *85488813 FastCGI sent in
stderr: "PHP message: PHP Warning: Uncaught ErrorException: Warning:
require(/var/www/my_app/releases/20180507153309/vendor/composer/../doctrine/mongodb/lib/Docsrine/MongoDB/Iterator.php):
failed to open stream: No such file or directory in file
/var/www/my_app/releases/20180507153309/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ApcClassLoader.php:112
in
/var/www/rec/releases/20180507153309/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ApcClassLoader.php:112
Have anyone else encountered similar issues?
We have taken a number of steps that solved the issue (we haven't encountered it in a week now).
1. Remove unused php modules - couchbase2, gd, amqp
2. Upgrade the version of igbinary module.
I've been trying to install a php 5.6 driver for mongodb on Ubuntu 12.04. (Will be using this on a Zend Framework 1.11 system, yes this is old, I am fully aware).
I've tried a few things, nothing works.
It seems I should get it to work using this installation:
http://php.net/manual/en/mongodb.installation.manual.php
But for some reason at the make all -j 5 step I get the following error:
In file included from /var/mongotest/mongo-php-driver/src/bson.c:29:0:
./phongo_compat.h:21:30: fatal error: Zend/zend_string.h: No such file or directory
compilation terminated.
In file included from /var/mongotest/mongo-php-driver/src/bson-encode.c:29:0:
./phongo_compat.h:21:30: fatal error: Zend/zend_string.h: No such file or directory
Just install php5.6-dev, it includes all the header files.
I installed Zend Server 8, and I need to run scripts that use MySQL via the command line.
I get this error when I run one of my CLI scripts:
PDOException
could not find driver
But everything works via http, problem only occurs in CLI. I know there is a different php.ini for the CLI. However, when i reference the php.ini that the server uses for http like this:
php -c/usr/local/zend/etc/php.ini my-script
I get this:
Warning: PHP Startup: Unable to load dynamic library
/usr/local/zend/lib/php_extensions/pdo.so' -
/usr/local/zend/lib/php_extensions/pdo.so:
cannot open shared object file:
No such file or directory in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library /usr/local/zend/lib/php_extensions/readline.so' - /usr/local/zend/lib/php_extensions/readline.so:
cannot open shared object file:
No such file or directory in Unknown on line 0
Fatal error: Class 'PDO' not found in /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php on line 155
I have no idea how to troubleshoot this. I use Ubuntu 14.04 if that makes a difference.
It might also be useful to say that I installed LAMP first like this:
sudo apt-get install lamp-server^ and then I installed Zend Server
Any suggestions?
Thank you.
I ended up just changing the php alias to the php that was installed by Zend Server like this:
alias php=/usr/local/zend/bin/php
This seems to work, but still looking for a better/proper solution.
Heroku does not support PHP officially, so I needed to add PHP extensions manually. I have created a php.ini file on my main directory:
extension_dir = "/app/www/ext/"
extension=mongo.so
extension=oauth.so
extension=solr.so
All the extension files are on the ext folder which is on the main directory also. Mongo and OAuth extensions are working perfectly but when Solr added, apache is giving me the error below:
PHP Warning: PHP Startup: Unable to load dynamic library '/app/www/ext/solr.so' - /lib/libc.so.6: version `GLIBC_2.14' not found (required by /app/www/ext/solr.so) in Unknown on line 0
...and Solr extension is not working, obviously. I'm using Websolr add-on on Heroku and unfortunately neither Heroku nor Websolr is willing to help me about the issue. Heroku says "PHP is not officially supported," and Websolr says "ask Heroku."
So, any help will be appreciated.
It seems that there are no direct solutions but I have found a workaround. Instead of using solr.so extension, one can use open-source solr-php-client from here. It does note require a compiler, so no apache errors on Heroku.
I am trying to fix an online site, but before that I would like to make it work on my local machine/wamp. Everytime I click on Search event and Register links on the site, the error below shows up.
Warning: require_once(XML/Unserializer.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\xxxxxx\includes\common_form_controls.php on line 19
Fatal error: require_once() [function.require]: Failed opening required 'XML/Unserializer.php' (include_path='.;C:\php\pear') in C:\wamp\www\itsonat\includes\common_form_controls.php on line 19
Is it because I don't have xml_unserializer installed on my computer? Where and How do I install it? I've been trying to install Pear in my wamp, but I am unsure of the relationship between Pear and XML_serializer.
Can someone please help me on how to fix this problem?
Thanks heaps. S:)
PEAR can be installed, of course. There are a couple of guides out there.
Also, install the PEAR modules required by your app to work properly, perhaps following this guide.
Hope it helps.