Warning: DOMDocument::load() [domdocument.load]: I/O warning : failed to load external entity - dom

I was using this piece of php script in a application running under over XAMPP on my local machine:
$dom = new DomDocument();
$filename = "library.xml";
if (!$dom->load($filename))
die("Could not parse iTunes XML file: ".$filename);
Then i tried to move this application to a WampServer without success, with the following warning:
Warning: DOMDocument::load() [domdocument.load]: I/O warning : failed to load external entity "file:///C:/wamp/www/parser/library.xml" in C:\wamp\www\parser\includes\libs\itunes_xml_parser.lib.php on line 111
This line in the error is exactly the load line, which worked flawlessly in earlier versions of XAMPP and isn't working now on XAMPP 1.7.7

As per this why don't you try using an absolute path for your filepath.
Also i see that this php file is located at C:\wamp\www\parser\includes\libs and library.xml is being searched at C:/wamp/www/parser/. Is this correct?
It could also be possible that you had turned off warnings/errors in your earlier xampp installation.So check this also.

Related

Installing php extension for SQL Anywhere on server with CentOS, Plesk, php-fpm

we got a new WebServer with CentOS, Plesk and php-fpm.
Now we don't get the php extension running.
What we did:
installed latest SQL Anywhere 17 (ebf29577)
copied php-7.3.0_sqlanywhere_r.so to /opt/plesk/php/7.3/lib64/php/modules/
loading php-7.3.0_sqlanywhere_r.so via /opt/plesk/php/7.3/etc/php.d/sqlanywhere.ini
this leads to an error:
WARNING: [pool plesk-php73-fpm.plesk-service.localdomain] child 11616 said into stderr: "NOTICE: PHP message: PHP Warning: request_startup() for sqlanywhere module failed in Unknown on line 0"
(This leads to php 7.3 fpm is not loading at all)
next try was to switch from FPM to CGI: same error
module is loadable itself within shell if LD_LIBRARY_PATH was enhanced with path /opt/sqlanywhere17/lib64/
some tries getting the cause by strace did not help
Has anybody an idea or maybe even successfully installed php extension.
Thanks
Florian
after a lot of tests we found a solution:
in Plesk Domain php settings we had to add:
[php-fpm-pool-settings]
env[LD_LIBRARY_PATH]="/opt/sqlanywhere_v2/lib64:$LD_LIBRARY_PATH"
Now all libs are found and it works
For me solution was, creating custom handler:
plesk bin php_handler --add -displayname "PHP SQLAnywhere 7.4" -path /opt/php-custom-handlers/7.4/php-sqlanywhere.fcgi -clipath /opt/plesk/php/7.4/bin/php -phpini /opt/plesk/php/7.4/etc/php.ini -type fastcgi
php-sqlanywhere.fcgi contents:
#!/bin/bash
LD_LIBRARY_PATH=/opt/sqlanywhere17/lib64
export LD_LIBRARY_PATH
exec /opt/plesk/php/7.4/bin/php-cgi "$#"
And finally using this handler on domain php settings and adding on additional directives:
extension=sqlanywhere.so

PHP Warning: Module 'imagick' already loaded in Unknown on line 0, need some assistance

So I checked my spam folder today and had 122 messages send through the server stating:
PHP Warning: Module 'imagick' already loaded in Unknown on line 0
Non stop it keeps sending me this.
Googled it and still have no clue on how to fix it as I need a step by step answer.
Found a similar question on stack but it's too complicated for me to understand.
I'm on the latest Plesk Onyx and OS=Ubuntu 16.04.6 LTS‬.
As I'm running php 7.3 I hoped when I uninstalled php 7.0 in plesk it would go away but unfortunately it didn't.
It's send from here
Cron <root#server> [ -x /usr/lib/php/sessionclean ] && /usr/lib/php/sessionclean
And after php --ini (read about it on a forum) this was the result:
PHP Warning: Module 'imagick' already loaded in Unknown on line 0
Configuration File (php.ini) Path: /etc/php/7.0/cli
Loaded Configuration File: /etc/php/7.0/cli/php.ini
Scan for additional .ini files in: /etc/php/7.0/cli/conf.d
Additional .ini files parsed: /etc/php/7.0/cli/conf.d/00-ioncube-loader-7.0.ini,
/etc/php/7.0/cli/conf.d/10-mysqlnd.ini,
/etc/php/7.0/cli/conf.d/10-opcache.ini,
/etc/php/7.0/cli/conf.d/10-pdo.ini,
/etc/php/7.0/cli/conf.d/15-xml.ini,
/etc/php/7.0/cli/conf.d/20-calendar.ini,
/etc/php/7.0/cli/conf.d/20-ctype.ini,
/etc/php/7.0/cli/conf.d/20-curl.ini,
/etc/php/7.0/cli/conf.d/20-dom.ini,
/etc/php/7.0/cli/conf.d/20-exif.ini,
/etc/php/7.0/cli/conf.d/20-fileinfo.ini,
/etc/php/7.0/cli/conf.d/20-ftp.ini,
/etc/php/7.0/cli/conf.d/20-gd.ini,
/etc/php/7.0/cli/conf.d/20-gettext.ini,
/etc/php/7.0/cli/conf.d/20-iconv.ini,
/etc/php/7.0/cli/conf.d/20-imagick.ini,
/etc/php/7.0/cli/conf.d/20-imap.ini,
/etc/php/7.0/cli/conf.d/20-json.ini,
/etc/php/7.0/cli/conf.d/20-mbstring.ini,
/etc/php/7.0/cli/conf.d/20-mysqli.ini,
/etc/php/7.0/cli/conf.d/20-pdo_mysql.ini,
/etc/php/7.0/cli/conf.d/20-pdo_sqlite.ini,
/etc/php/7.0/cli/conf.d/20-phar.ini,
/etc/php/7.0/cli/conf.d/20-posix.ini,
/etc/php/7.0/cli/conf.d/20-readline.ini,
/etc/php/7.0/cli/conf.d/20-shmop.ini,
/etc/php/7.0/cli/conf.d/20-simplexml.ini,
/etc/php/7.0/cli/conf.d/20-sockets.ini,
/etc/php/7.0/cli/conf.d/20-sqlite3.ini,
/etc/php/7.0/cli/conf.d/20-sysvmsg.ini,
/etc/php/7.0/cli/conf.d/20-sysvsem.ini,
/etc/php/7.0/cli/conf.d/20-sysvshm.ini,
/etc/php/7.0/cli/conf.d/20-tokenizer.ini,
/etc/php/7.0/cli/conf.d/20-wddx.ini,
/etc/php/7.0/cli/conf.d/20-xmlreader.ini,
/etc/php/7.0/cli/conf.d/20-xmlwriter.ini,
/etc/php/7.0/cli/conf.d/20-xsl.ini,
/etc/php/7.0/cli/conf.d/20-zip.ini,
/etc/php/7.0/cli/conf.d/zend_extensions_psa.ini
I already know it's probably easily fixed when you know linux but I'm learning on the go and posses very little knowledge yet.
Could anyone assist me with the right commands?
Cheers
Locate where is your php.ini file by:
php -i | grep Configuration
Configuration File (php.ini) Path => /usr/local/etc/php/7.4
Loaded Configuration File => /usr/local/etc/php/7.4/php.ini
Open the php.ini file and remove the line:
extension=imagick.so
or change the line to a comment:
; extension=imagick.so

info: Trying to load file 'OEMFMFileList.xml' as a FM file list ... fatal error : Error: Missing package - Creating basic IoT Core Image Powershell

I am just trying to create a basic IoT core image by following this guide.
But I am always getting the below errors, whenever I run buildimage <product name> Test after building the BSP (Import-IoTBSP RPi2 C:\Downloads\RPi_BSP.zip (or) importbsp RPi2 C:\Downloads\RPi_BSP.zip
buildpkg RPi2)
info: Trying to load file 'C:\OEEWorkspace\Build\arm\InputFMs\OEMFMFileList.xml' as a FM file list ... fatal error : Error: Missing package: C:\OEEWorkspace\Build\arm\pkgs\test.OEM.Sample.cab
info: Trying to load file 'C:\OEEWorkspace\Build\arm\InputFMs\RPi2FMFileList.xml' as a FM file list ... fatal error : Error: Missing package:
I also followed this issue in GitHub, but couldn't find the exact issue. Have you ever faced any error something similar?
Huh!. It was a silly mistake. I didn't run the New-IoTCabPackage All (or) buildpkg all after building the BSP (Import-IoTBSP RPi2 C:\Downloads\RPi_BSP.zip (or) importbsp RPi2 C:\Downloads\RPi_BSP.zip
buildpkg RPi2). Hence the cab files were not pushed into the Build\arm\pkgs folder.
After running the buildpkg all I am able to see all the required cab files in the pkgs folder, thus no error. You must do the commands in the below order.
PS C:\OEE>importbsp RPi2 "C:\Users\SibeeshVenu\Downloads\RPi_BSP.zip"
PS C:\OEE>buildpkg all
PS C:\OEE>newproduct OEEIoTCore RPi2
PS C:\OEE>buildimage OEEIoTCore Test
Once that is done, you should be able to see an output as below.

Error while connecting to sybase database using dbd:sybase

I have compiled dbd-sybase module(1.07) to add it to my perl(5.12.3) on windows. However, when I trying to use it using following script:
use DBI;
DBD::Sybase;
$ENV{SYBASE} = 'E:\Sybase';
$ENV{SYBASE_OCS} = 'OCS-15_0';
$ENV{SYBASE_ASE} = 'ASE-15_0';
$SERVER="ABC";
$DATABASE="dadw";
$USER_NAME="";
$PASSWORD="";
$dbh = DBI->connect("dbi:Sybase:server=$SERVER;databse=$DATABASE",$USER_NAME, $PASSWORD);
I am getting following error message:
install_driver(Sybase) failed: DBD::Sybase initialize: cs_ctx_alloc(113) failed
at c:/perl/lib/DynaLoader.pm line 223.
Compilation failed in require at (eval 4) line 3.
at b.pl line 11
Can someone help in solving this error message.
It appears that the driver is using CT-Connect libraries, so I would guess it needs to have valid server information in the interfaces file.
On windows the file is usually located in C:/sybase/interfaces.ini
Check this answer for more details on creating interface file entries.
Using Sybase ASE BCP to a Remote Server
In Sybase, the interfaces file in Windows is called sql.ini and it is located in the c:Sybase/ini/ folder.

How to configure and use Mailgun's SDK with composer-php?

I installed Composer and a SDK for Mailgun's service. These are the steps i followed:
# current directory
cd ~
# Install Composer
curl -sS https://getcomposer.org/installer | php
# Add Mailgun as a dependency
php composer.phar require mailgun/mailgun-php:~1.7
According to the instructions, all I did after that was (index.php):
<?php
require 'vendor/autoload.php';
use Mailgun\Mailgun;
# First, instantiate the SDK with your API credentials and define your domain.
$mg = new Mailgun("key-my-key-goes-here-987654321");
$domain = "somedomain.com";
Then, I tried to get the list of bounced emails:
$data = $mg->get("$domain/bounces", array('limit' => 15, 'skip' => 0));
var_dump($data);
...and I'm getting this error:
Warning: require(vendor/autoload.php): failed to open stream: No such
file or directory in /var/www/html/index.php on line 2 Fatal error:
require(): Failed opening required 'vendor/autoload.php'
(include_path='.:/usr/share/pear:/usr/share/php') in
/var/www/html/index.php on line 2
So I'm guessing it has something to do with composer's installation/configuration perhaps? Thanks for any help...
The way you programmed it, you must have the following files all in the same directory:
composer.json
index.php (your test script)
And you must have run the composer require command while being inside this directory. This will also create a directory named vendor here, and add plenty of files, amongst them vendor/autoload.php.
If however your test script isn't in this location, the require call will not find the file where you tell PHP to find it. This isn't any failure of Composer, but simply the fact that you have to include that file according to your situation, not by copy&paste code. If you change the path of your test script, you have to change the path of the vendor directory as well.