PHP error log problem 'Unable to load dynamic library' - php

My PHP error logs are filling up extremely rapidly with the following line:
[28-Apr-2011 13:03:00] PHP Warning:
PHP Startup: Unable to load dynamic
library
'/usr/local/lib/php/extensions/no-debug-non-zts-20060613/'
- /usr/local/lib/php/extensions/no-debug-non-zts-20060613/:
cannot read file data: Is a directory
in Unknown on line 0
I've googled the issue and found several results, but all involving something after the last / where this error appears to be something to do with the path itself.
The site(s) are running on cPanel/WHM on CentOS.

You will need to check your php.ini. One of the entries there does not specify a correct filename, but probably something like this:
extension = .
; or the raw pathname as shown in your error.log
extension = /usr/local/lib/php/extensions/no-debug-non-zts-20060613/
That's why the error says Is a directory.
The in Unknown on line 0 refers to your php.ini (it does not have a __FILE__ or __LINE__ number, so leads to that mysterious location hint.)

Related

Unable to load dynamic library 'php_sockets.dll'

Ok, so when I run my php file it gives me this error:
PHP Warning: PHP Startup: Unable to load dynamic library 'php_sockets.dll'
In my php.ini file, I've added the line "extension=php_sockets.dll" but it still gives me this error. I've searched many ways of solving this problem but they didn't work.
I've noticed someting in the error. It said this:
C:\xampp\php\ext\php_php_sockets.dll.dll (The specified module could not be found.))
Why does it say php_php_socketsdll.dll? How can I fix this?

simplexml_load_file(): I/O warning : failed to load external entity "/user-bundle/Resources/config/doctrine/model/User.orm.xml

I have some issue with my production deployment of Symfony2,
I've tried many solutions, but none have worked.
I randomly have this error when accessing my symfony application on production environment:
( ! ) Fatal error: Uncaught exception 'Symfony\Component\Debug\Exception\ContextErrorException' with message 'Warning: simplexml_load_file(): I/O warning : failed to load external entity "/home/user/symfony/vendor/friendsofsymfony/user-bundle/Resources/config/doctrine/model/User.orm.xml"' in /home/user/symfony/app/bootstrap.php.cache on line 2998
( ! ) Symfony\Component\Debug\Exception\ContextErrorException: Warning: simplexml_load_file(): I/O warning : failed to load external entity "/home/user/symfony/vendor/friendsofsymfony/user-bundle/Resources/config/doctrine/model/User.orm.xml" in /home/user/symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php on line 736
Call Stack
# Time Memory Function Location
1 0.0000 262880 {main}( ) ../app_dev.php:0
2 0.0015 572736 Symfony\Component\HttpKernel\Kernel->handle( ) ../app_dev.php:79
3 0.1342 4023952 Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle( ) ../bootstrap.php.cache:2376
( ! ) LogicException: Request stack is empty in /home/user/symfony/app/bootstrap.php.cache on line 2998
Call Stack
# Time Memory Function Location
1 0.3330 7110120 Symfony\Component\Debug\ErrorHandler->handleException( ) ../classes.php:0
2 0.3331 7119696 Symfony\Component\Debug\ErrorHandler->handleException( ) ../classes.php:1939
I've tried to upgrade my php version (I was in php 5.4.x and now in 5.6.4),
I've tried to upgrade lixml2 version (i am in 2.8.0 now, but i already tried to upgrade in 2.9.3)
I've constated that the version of libxml used in php is always 2.8.0, but, I haven't found the way to change this ,
I've tried to set the all directory of symfony in chmod 777
My server is a debian 7.5 server.
Maybe someone who knows this error can help me
Here is some links to differents question related to this one:
Random Error, FOSUserBundle Error and Service error
I didn't post in them because they're all outdated
[EDIT]
I found a quick fix, but it's in vendors, so it will be overrided in the first update of the doctrine update:
QuickFix in XmlDriver.php Line 737
$xmlElement = #simplexml_load_file($file);
if(!$xmlElement){
$xmlData = file_get_contents($file);
$xmlElement = simplexml_load_string($xmlData);
}
We got this error after we started using libxml_disable_entity_loader(true); in our code. That code is vital in preventing XXE -attacks(more info of that in here). If you don't have that in your code, it could be that you have installed/updated a bundle which has that line of code in use. Note that libxml_disable_entity_loader() is not thread safe, so if there is one piece of code on one thread that executes that line, everything on that server now has that enabled throughout the process.
The FOS-bundle seems to use xml-definitions, that in return have external entities in them. Nothing major though, but that code prevents the FOS-bundles methods from using those files correctly.
Luckily, our service got that error only in one place, and the fix was obvious:
Add a libxml_disable_entity_loader(false); before executing that piece of code where the error comes from, and add libxml_disable_entity_loader(true); right after that piece of code.
This way the user bundle could load the xml:s it needed, but security is not compromised.
Example:
libxml_disable_entity_loader(false);
$user = $query->getOneOrNullResult(); // This generates an error if entity loader is disabled
libxml_disable_entity_loader(true);
The error mentioned usually happens when the xml file does not exists.
You can try check if the file really exists after try to load:
if (file_exists($file)) {
$xmlElement = #simplexml_load_file($file);
}
I tried to simulate the error locally running php interactively, the results are in down:
php > simplexml_load_file('test.xml');
PHP Warning: simplexml_load_file(): I/O warning : failed to load external entity "test.xml" in php shell code on line 1
php >
Note, the error above is the same that you mentioned on the question. So, the first try is use the file_exists() function to check if the file really exists after try to load it. The next step is check if the current path - using getcwd() - and the path of the file are pointing correctly to the file.
I created a file called test.xml on /tmp folder:
<test>
<worked>
</worked>
</test>
Called the interactive mode on php:
$ php -a
Interactive mode enabled
So, checked my local directory:
php > echo getcwd();
/tmp
And, tried to load the file:
php > $data = simplexml_load_file('test.xml');
php > var_dump($data);
object(SimpleXMLElement)#1 (1) {
["worked"]=>
object(SimpleXMLElement)#2 (1) {
[0]=>
string(2) "
"
}
}
Note: that worked correctly. So, probably, your file does not exists or the path are incorrect. The path considers the current path /tmp plus, the file indicated on the function call test.txt, or equals to call the /tmp/test.txt file.
In my case, the problem on new hosting was:
allow_url_fopen
was disabled (any simplexml_load_file() or file_get_contents() returned false).
Solution: enable allow_url_fopen.
There are some solutions given:
https://github.com/FriendsOfSymfony/FOSUserBundle/issues/1062
https://github.com/symfony/symfony/issues/7291

All php files showing as 500 Internal Server Error

Problem: Any php file we attempt to access on our website shows up as a 500 internal server error. I'm not sure if this is related but I have had a look in the error logs and the below error appears:
[08-Nov-2013 12:41:51 UTC] PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php/extensions/no-debug-non-zts-20090626/htscanner.so' - /usr/local/lib/php/extensions/no-debug-non-zts-20090626/htscanner.so:
cannot open shared object file: No such file or directory in Unknown on line 0
Attempt: Some of the things I have tried to do is delete the over size error log and renamed the htaccess file to see if that was causing the problem.
Page: You can see the problem at this page: http://science.org.au/support-us/donate-now.html (Half way down in the iframe)
Question: Does anyone have any ideas on how to fix this? Things to try?
Did you try this?
edit the file /etc/php5/cli/php.ini:
and remove the lines:
[htscanner] Extension = “htscanner.so”
config_file = “.htaccess”
default_docroot = “/var/www”
You should pay more attention to what your error log says. According to it, you should either install htscanner.so PHP extension, or remove reference to it from your php.ini.

PHP Startup: Unable to load dynamic library

I have notice I started getting this error message in my error log:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/lib/php
/extensions/no-debug-non-zts-20060613/pdf.so' - /usr/local/lib/php/extensions
/no-debug-non-zts-20060613/pdf.so: cannot open shared object file: No such file
or directory in Unknown on line 0
The error goes into the log every time you open the main page but everything seems to be working. Does anyone have any ideas what might cause this error to occur, I have been change the code in the past few days but when read back though I can't find anything that could be the cause.
there's nothing on the page that I have changed for when it initially loads but i have changed things in areas where I have if (isset...etc.
Any possible suggestions are appreciated. what type of command might this error message be caused by?
It appears your PHP installation is configured to load http://www.php.net/manual/en/intro.pdf.php and cannot find it.
Remove its respective extension entry in php.ini or fix the path or ensure the file exists if you require it.

Apache htdocs in folder with unicode name

I have my apache (for windows) htdocs in a folder like c:\anything1\怘怙怚怛\anything2. The problem is that in this case php won't execute any scripts from here and will display an error message like this:
`Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'c:/anything1/怘怙怚怛/anything2/index.php' (include_path='.;C:\php5\pear') in Unknown on line 0
`
If I try to open a html file, it is served by apache, so it seems that the problem appears only with php.
Do you have an idea how to solve this?
I may be wrong but I'd say you can't do it without patching PHP. Apache (or the PHP apache handler) passes PHP a path encoded in UTF-8 and PHP ultimately relies on the ANSI version of FindFirstFile (and you cannot set a UTF-8 codepage).
I suggest you submit a bug report.
i have same problem,
Read more # http://www.oneminuteinfo.com/2011/02/solve-php-failed-to-open-stream-error.html
it may be help you

Categories