php autoload searches for invalid path - php

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.

Related

Homebrew throwing unable to load dynamic library error with all versions of PHP on macOS Sierra

When I install PHP using Homebrew, any extensions that I attempt to load (including the core extensions such as mysqli and gd2) throw an Unable to load dynamic library error during any usage. Is there a solution available?
The error thrown is as follows:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php70/7.0.15_8/lib/php/extensions/no-debug-non-zts-20151012/php_mysqli.dll' - dlopen(/usr/local/Cellar/php70/7.0.15_8/lib/php/extensions/no-debug-non-zts-20151012/php_mysqli.dll, 9): image not found in Unknown on line 0
The folder referenced, /usr/local/Cellar/php70/7.0.15_8/lib/php/extensions/no-debug-non-zts-20151012, does not exist. The command used for installation was homebrew/php/php70 --with-httpd24 --with-pear. I also attempted without the --with-pear flag.
I note that while the error refers to DLL files for some reason, changing these to SO files in the php.ini file does not resolve the problem, as the files still do not exist anywhere on the system.
I have now attempted this installation on a clean macOS 10.12.3 system, trying PHP 5.6 first and then PHP 7.0. Both experience the same issue.
I have also opened an issue on GitHub, but I was hoping someone might have experienced a similar issue and managed to resolve the problem.

Composer and PHP versions, ignoring PHP version on Composer install, a bad idea?

After PHP being updated on our server (Centos 5.11) to be > v5.3.2, I want to get Composer installed like I have in my other environments.
The Composer docs state that "Composer requires PHP 5.3.2+ to run". I have PHP 5.4.45. Still, when trying
curl -sS https://getcomposer.org/installer | php
It exits with the warning
PHP Warning: file_get_contents(https://getcomposer.org/versions): failed to open stream: Connection timed out in - on line 762
PHP Warning: Invalid argument supplied for foreach() in - on line 508
None of the 0 stable version(s) of Composer matches your PHP version (5.4.45 / ID: 50445)
I found this answer which deals with ignoring system requirements when installing Composer.
Is this something that could be done or is it a somewhat scary/thoughtless thing to do? And, are there other versions ("unstable" or otherwise) of Composer that I could use? Or perhaps PHP should be updated again -> 5.6.x?
Thanks for any tips and help!
I changed from https to http,
curl -sS http://getcomposer.org/installer | php
Then was able to install
It's not a matter of your PHP version, but a connectivity issue.
You have 3 messages (2 warnings and one composer's info), which tell you the whole story.
(1st warning) Composer's installer couldn't fetch list of Composer's list of versions due to connection timeout, so (2nd warning) it didn't have a list to iterate over and match Composer's version suitable for your PHP version, which implied that (3rd message) no version of composer was found.
The root problem is the first warning. This line
file_get_contents(https://getcomposer.org/versions);
didn't work. And that's your issue.
It's hard to tell you exact solution basing of provided information.
I think it could be proxy problems. Deleting the https_proxy and http_proxy environment vars worked for me (Windows 10). And then installing it, set proxy in blank. It should work as it did for me.

Why will php pthreads not work? http error internal server code 500.0

I am attempting to make use of threading within my php application, but for reasons unknown to myself I cannot seem to set php up to use pthreads.
Here are a few details FYI to help diagnose the issue:
My environment is IIS on Windows 10.
My php version is 7.0.7.
Thread Safety is showing as 'enabled' in phpinfo()
My PHP Extension Build is 'API20151012,TS,VC14'
I have tried several pthreads releases of version 'VC14'
php_pthreads.dll has been copied to 'C:\Program Files\PHP\v7.0.7\ext'
pthreadVC2.dll has been copied to 'C:\Program Files\PHP\v7.0.7' and 'C:\Windows\System32'
extension=php_pthreads.dll has been added to php.ini
When I comment out extension=php_pthreads.dll and load the home page I get
Fatal error: Class 'Thread' not found
But when I un-comment the line I get:
HTTP Error 500.0 - Internal Server Error C:\Program
Files\PHP\v7.0.7\php-cgi.exe - The FastCGI process exited unexpectedly
What could be the reasons for those problems?
'The cgi-fcgi SAPI is not supported by pthreads'
After doing some research on the above error I found out that since PHP 7.0.0 pthreads has only been available on the command line, so the answer is to either downgrade the PHP version or disable the threading for the web server, and you can see how to do that HERE

why aws.phar runs once then won't load again?

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.

Difficulties installing php enchant on Windows

Okay, I've read the php.net docs, I've browsed numerous sites including stackoverflow for solutions and nothing has helped. So I'm asking, is there anyone who can post a definitive guide for getting enchant to work on Windows?
My set up is:
Windows 7
WAMP Server 2.0
PHP 5.3.0
PHP is located in
C:/wamp/bin/php/php5.3.0
I downloaded the php_enchant.dll from http://downloads.php.net/pierre/php_enchant-1.1.0-5.3-vc9-x86.zip and unzipped its contents. I did as the readme stated and
moved php_enchant.dll into C:/wamp/bin/php/php5.3.0/ext (my
extensions path)
moved all other dll files into C:/wamp/bin/php/php5.3.0
added extension=php_enchant.dll to my php.ini
restarted httpd
For dictionaries, I followed the first answer here PHP: Enchant Spell Checking not working. Configuration in Windows?
I downloaded the correct dictionary zips from Mozilla
I placed them inside of C:/wamp/bin/php/php5.3.0/share/myspell/dicts
After all of this trying to run
enchant_broker_init();
gives a fatal error. I really don't know what else to do. If anyone can give me some advice I'd really appreciate it.
Edit: Okay so my apache error log gives the following error
PHP Warning: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.3.0/ext/php_enchant.dll' - The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.\r\n in Unknown on line 0 <b>Warning</b>: PHP Startup: Unable to load dynamic library 'c:/wamp/bin/php/php5.3.0/ext/php_enchant.dll' - The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.in <b>Unknown</b> on line <b>0</b>[Wed Mar 05 15:28:02 2014] [notice] Child 6128: Child process is running
Pulling out my hair now.
Do you really mean WAMPServer 2.0?
That enchant was compiled with VC9, check that your PHP and Apache were also compiled with VC9, if not you need an enchant dll that was compiled with the same compiler as your Apache and PHP.
As you have PHP5.3.0 I would guess they are compiled with VC6.
Had the same problem. Add PHP path to Windows PATH variable and restart wampserver.

Categories