API logging using log4php - php

I have log4php working via the command line successfully but I am struggling when using it with an PHP API (via Apache).
The error I am getting is;
PHP Warning: log4php: Configuration failed. Error loading configuration file: failed
to load external entity "logging.xml"
logging.xml is in the same directory as the PHP file and is loaded via;
$configFile = "logging.xml";
Logger::configure($configFile);
Ideas please? I tried changing it to use the full URL for the file and the full local path and they result in the same error.
The same setup works via the CLI.

Related

Seemingly missing file when using JanRain OpenID PHP library with MySQL

I've just set up the JanRain OpenID library for PHP (https://github.com/openid/php-openid). I'm attempting to use the example server file, and the error I get is:
Warning: require_once(DB.php): failed to open stream: No such file or directory in /path/to/file/examples/server/config.php on line 28
I have searched the package and have not found any such file (DB.php). I do not see mention of it being generated. The config file I'm using was generated by the JanRain library's setup.php script.
Can anyone point me in the direction of what this file (which the library seems to expect) is and how I can obtain it?
DB.php is a part of pear DB package,
#pear install DB
for centos 6.x
#pear install DB-1.8.2
Thank for http://nobuneko.com/blog/archives/2016/01/php_533_pear_install_db_failed_php_540_higher.html

How to fix PHP error from file ApplicationError.php for sending emails

I'm trying to send an email using PHP from Google App Engine. To send an email, Require Once must include the php file Message.php: See: Code example here at Google
require_once 'google\appengine\api\mail\Message.php';
The Message.php file includes:
require_once 'google/appengine/api/mail/BaseMessage.php';
The BaseMessage.php file in turn requires three other PHP files:
require_once 'google/appengine/api/mail_service_pb.php';
require_once 'google/appengine/runtime/ApiProxy.php';
require_once 'google/appengine/runtime/ApplicationError.php';
So, to recap, Message.php requires BaseMessage.php and BaseMessage.php requires 3 more php files.
Everything works fine until that last PHP file that is required:
require_once 'google/appengine/runtime/ApplicationError.php';
Then a fatal error happens:
Fatal error: Class 'google\appengine\runtime\Error' not found in
C:\Users\UserName\Dropbox\ApplicationName\google\appengine\runtime\
ApplicationError.php on line 22
This is line 22:
class ApplicationError extends Error {
This is code that is provided by Google: the latest PHP SDK for App Engine
It's not code that I wrote. The path to the required files seems to be working, or else I'd get an error msg on the first required file. I've tested require_once lines of code that reference other PHP files in the same directories with no errors. So the issue isn't a problem with the relative path or the PHP.ini file.
My PHP version is Current PHP version: 5.4.22
Windows 7
XAMPP with Netbeans, Apache
How do I fix this problem?
I got the PHP email code to work. I still don't know what the exact problem was to begin with, but it must have something to do with how my Netbeans IDE is currently configured to PHP. The Google App Engine SDK has PHP built into it's installation, but I wasn't running my app from the Google App Engine Launcher. When I ran my app directly from the Google App Engine Launcher, the code worked. I'm guessing that the Netbeans version of PHP was a little different than the Google App Engine SDK version of PHP. And that caused an error in one of the files. In any case, I got the PHP code that sends a email to work. So, the code will run. That tells me that my configuration to PHP in Netbeans probably isn't the same as the configuration to PHP in the version of PHP in the Google App Engine SDK. I might try tweaking the PHP.ini file in netbeans to see if I can link directly to the Google App Engine SDK verion of PHP.

Why can't PHP find a libpng15.so.15?

I'm running ArchLinux 64bit, I'm trying to create a Clickstack to run Symfony on Cloudbees.
I've created a Clickstack that extends PHP-ClickStack
When trying to test the bundled PHP I get the following error:
php: error while loading shared libraries: libpng15.so.15: cannot open shared object file: No such file or directory
I've downloaded and installed LibPng15 to /usr/local/.
I've also copied that file to: /path/to/php/lib/, /path/to/php/include/, and /path/to/php/bin/. It hasn't fixed the error.
I've also downloaded tried downloading the source for PHP-5.4.24 and 5.5.8 but, when I compile them they both some of the Intl tests.
So how can I get a working binary version of PHP that I can upload to Cloudbees?
The solution was to create LD_LIBRARY_PATH as an environment variable in script.
Apparently it didn't exist.
LD_LIBRARY_PATH=/usr/lib:/usr/local/lib/:/path/to/libpng/
NOTE: adding the normal directories prevents other tools/apps from breaking.

SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://...' in Google App Engine PHP App

I am trying to connect to Amazon Web Services from my GAE account using a simple PHP script. However, the very first line is throwing an error:
$wsdlURI = 'http://www.webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl';
$soapClient = new SoapClient($wsdlURI);
I get this error:
SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://.....'failed to load external entity
When I do a simple file_get_contents on the above URL, it works just fine. Only the SoapClient is not able to get the handle on the wsdl file....and ONLY GAE seems to have this problem. I tried the same code on another server and everything works fine.
Is there any setting in GAE that I am missing??
This is also related to the disabling of loading of loading of external entities by default, you will need to enable this to get this to work.
First, you must create a php.ini file containing this line:
google_app_engine.enable_functions = "libxml_disable_entity_loader"
Then you add the following before your call.
libxml_disable_entity_loader(false);
For SoapClient to work using sockets application also needs to have billing enabled.
This issue is likely related: https://code.google.com/p/googleappengine/issues/detail?id=9858 .
Looks like SOAP needs sockets support, which is not yet part of the PHP runtime.
Check that you have the following extensions activated:
php open ssl
and
php soap client.

Yii can't find GearmanClient

I am trying to create tasks using gearman using GearmanClient class from the gearman-php-extensions. I am able to run below program using command prompt-
//php client.php works fine
<?php
$client= new GearmanClient();
$client->addServer();
$task = $client->do("send", "hi");
?>
But I wan't to run this code in some yii controller. It seems like yii is not able to find the path upto GearmanClient class, but why?
Also I am writing the yii programs in eclipse. As php command and eclipse are both using the same php library, my yii controller should work fine. Instead my browser gives errors like-
PHP warning
include(GearmanClient.php): failed to open stream: No such file or directory
#plus some warnings and the yii stack trace.
This is happening because, the process that is handling the php files is not updated with the latest php.ini configuration. So you just need to restart that process.
Therefore:
If php handler is running as a web server module, then you'll need to restart the web server.
If you have php running as a cgi process, then you'll need to restart that process.

Categories