I've got an issue running my ownCloud instance on a Synology NAS. I get to following log error:
PHP Startup: No such handler: DBA_DEFAULT at Unknown#0
... which should be about the connection to the database.
It is very confusing, because the database can be called by ownCloud, all connected clients work, the web interface works and so on... Only this message remains.
My configuration details:
Synology DS216j with DSM 6.0.2-8451 Update 7
PHP 5.6.28
MariaDB 5.5.53
ownCloud 9.1.3
I can find absolutely no information about that error...
I've been seeing this message on my Synology NAS recently and this is what I've found. My NAS has multiple Php installations, and I think this error is coming from the default installation.
root#synology:~# /bin/php --ri dba
Extension 'dba' not present.
but using my alternate php
root#synology:~# /usr/local/bin/php56 --ri dba
dba
DBA support => enabled
Supported handlers => gdbm cdb cdb_make db4 inifile flatfile
Directive => Local Value => Master Value
dba.default_handler => flatfile => flatfile
So one solution is to ensure that your application is invoking the correct Php version. For this you can manage the HTTP server and PHP version from the Synology Web Station.
Alternately I noticed that this message is E_WARNING level only and can be ignored (unless you need Berkley Database). I added this code to my application
function shutdownHandler()
{
try {
$error = error_get_last();
if ( $error !== NULL && $error["type"] == E_ERROR) {
$backtrace = "(E_ERROR) " . $error["message"];
$trace = debug_backtrace();
foreach($trace as $item) {
$backtrace .= "\n\t" . (isset($item['file']) ? $item['file'] : '<unknown file>')
. ' ' . (isset($item['line']) ? $item['line'] : '<unknown line>')
. ' calling ' . (isset($item['function']) ? $item['function'] : '<unknown function>') . '()';
}
\Logger::LogError( $backtrace, $error["file"], $error["line"]);
}
}
catch (Exception $e) {
print get_class($e)." thrown within the shutdown handler. Message: ".$e->getMessage()." on line ".$e->getLine();
}
}
# Registering shutdown function
register_shutdown_function('shutdownHandler');
I'm guessing ownCloud has a similar function, but it is probably logging all error messages, which is why you are seeing this message.
This happend on my DS114 with DSM 6.0.2-8451 Update 7 also, after the upgrade of Apache 2.2 on 6 January 2017. Before the upgrade all worked fine.
I have changed /volume1/#appstore/Apache2.2/usr/local/etc/apache22/conf/extra/mod_xsendfile.conf
from
XSendFilePath /var/services/web /var/services/homes
to
XSendFilePath /volume1/owncloud
and now it works again
Related
Trying to install CodeCeption with Laravel framework 5.6
I am getting this error.
Steps i followed to install are
1. composer require codeception/codeception --dev
2. php ./vendor/bin/codecept bootstrap
The error i am getting is
Fatal error: Declaration of Codeception\Test\Unit::getDependencies() must be compatible with PHPUnit\Framework\TestCase::getDependencies(): array in /vendor/codeception/codeception/src/Codeception/Test/Unit.php on line 14
Can someone tell how to fix this or downgrade and get it work with Laravel 5.6?
This was just fixed in codeception/codeception version 2.4.5, so run composer update, and the error should no longer be happening.
From the changelog (emphasis mine):
2.4.5
Fixed PHPUnit 7.2 compatibility.
Introduced RunBefore extension to execute scripts before running tests. See #5049 by #aashmelev.
[Db] Added two options for MySQL by #bangertz
ssl_cipher - list of one or more permissible ciphers to use for SSL encryption
ssl_verify_server_cert - disables certificate CN verification
[Db] Always disconnect before connect when reconnect is set. By #ashnazg
[Db] More explicit PDO closing upon destruction and close opened transactions by #ashnazg.
[Recorder Extension] Improved error logging by #OneEyedSpaceFish. See #5101
[Lumen] Fixed file uploads via REST module. By #retnek.
Fixed: function getMetadata() may not exist, results in fatal error. See #4913 by #marcovtwout
In Codeception/Test/Unit.php line no 133, change the getDependencies function to have a array return type. : array
After the change the getDependencies function should look like this.
public function getDependencies(): array
{
$names = [];
foreach ($this->getMetadata()->getDependencies() as $required) {
if ((strpos($required, ':') === false) and method_exists($this, $required)) {
$required = get_class($this) . ":$required";
}
$names[] = $required;
}
return $names;
}
How to enable the OCS Inventory interface described in OCS WebServices? Is there a sample code for using this Web Service in PHP?
The OCS interface is disabled by default, it is necessary to turn it on before use it. OCS has a core code developed in Perl and it runs over Apache HTTP.
First, edit the file /etc/apache2/conf-enabled/z-ocsinventory-server.conf changing the option value for OCS_OPT_WEB_SERVICE_ENABLED to 1.
If the web service is not enabled you should get a 401 Forbidden response. This is a SOAP WebService and there's no WSDL to describe the features, just the docs available in OCS WS Documentation.
Check if the location tag for /ocsinterface looks like the following snippet:
<Location /ocsinterface>
SetHandler perl-script
PerlHandler Apache::Ocsinventory::SOAP
# By default, you can query web service from everywhere with a valid user
Order deny,allow
Allow from all
AuthType Basic
AuthName "OCS Inventory SOAP Area"
# Use htpasswd to create/update soap-user (or another granted user)
AuthUserFile "/etc/apache2/passwd/soapinterface"
Require valid-user
</Location>
You should create a password for this location for security purposes, however, to turn the authentication off just comment out all Auth... and Require attributes.
Restart apache server, and use the PHP code below to test the web service integration
<?php
$proto = 'http';
$host = 'localhost';
$port = '80';
$user = ''; //basic authentication, if necessary
$pass = '';
$options = array(
'location' => "$proto://$host:$port/ocsinterface",
'uri' => "$proto://$host:$port/Apache/Ocsinventory/Interface",
'login' => $user,
'password' => $pass,
'trace' => TRUE,
'soap_version' => SOAP_1_1,
);
$request = '
<REQUEST>
<ENGINE>FIRST</ENGINE>
<ASKING_FOR>META</ASKING_FOR>
<CHECKSUM>131071</CHECKSUM>
<OFFSET>0</OFFSET>
<WANTED>131071</WANTED>
</REQUEST>';
try {
$client = new SoapClient(NULL, $options);
} catch (Exception $e) {
echo "<b>Construct Error</b>: " . $e->getMessage() . "<br>";
}
try {
$result = $client->get_computers_V1($request);
echo "<b>Headers:</b><pre>" . $client->__getLastRequestHeaders() . " </pre><br>";
echo "<b>Request:</b><pre>" . $client->__getLastRequest() . "</pre><br>";
echo "<b>Result:</b><pre>";
var_dump($result);
echo "</pre><br>";
} catch (Exception $e) {
echo "<b>Connection Error</b>: " . $e->getMessage() . "<br><br>";
echo "<b>Headers:</b><pre>\r\n" . $client->__getLastRequestHeaders() . " </pre><br>";
echo "<b>Request:</b><pre>\r\n" . $client->__getLastRequest() . "</pre>";
}
If you get a HTTP 500 Internal Server Error, check apache error log (tail -f /var/log/apache2/error.log -n 100) for the following error message:
Illegal field name 'APR::Table=HASH(0x7ff114bd75a8)' at /usr/local/share/perl/5.18.2/SOAP/Transport/HTTP2.pm line 103.\n
That error happens due to an incompatibility issue found in HTTP::Message perl module. The following links describes the problem and solution related to it:
http://ask.ocsinventory-ng.org/735/demande-dinformations-web-service-ocs-inventory
https://www.tnpi.net/support/forums/index.php?topic=1037.0
To fix it, you need to downgrade the HTTP::Message perl module to version 6.04. Use the command cpan -D HTTP::Message in your console to check which version you're using. This module version is a little bit old, so you won't find it in Search CPAN. In this regard, you should download the module HTTP-Message-6.04.tar.gz and install it manually by typing the following commands on your terminal:
decompress it using tar -zxf HTTP-Message-6.04.tar.gz
call the new directory cd HTTP-Message-6.04/
perl Makefile.PL
make
make test
make install
and finally, check if the module got downgraded successfully by typing cpan -D HTTP::Message(it should output ... Installed: 6.04 ...)
restart the server - service apache2 restart
Run the PHP snippet shown above to test it again.
Following an OSX 10.9.3 upgrade a number of things didn't work. Apache, Mongo and PHP are all working independently now, however the mongo extension for php is not. I am hoping the stackoverflow community can help. Here's the basic problem:
$ sudo pecl install mongo
pecl/mongo is already installed and is the same as the released version 1.5.3
install failed
$ php --re mongo
Exception: Extension mongo does not exist
Pecl and PHP are having a disagreement on whether the mongo extension is there. mongo.so does physically exist here: /opt/local/lib/php/extensions/no-debug-non-zts-20090626/mongo.so where it was installed and here: /usr/lib/php/extensions/no-debug-non-zts-20100525 where I copied it because that is where php.ini points. It is executable in both places. It seems odd that it is getting installed in the wrong spot, so maybe there is a pecl config that needs to be flipped? Also pecl is not finding php.ini at the end of the install, but I am updating manually.
The best summary of the directions for getting back up after the 10.9 upgrade appears to be here: http://fighterpilotstress.blogspot.com/2013/10/installing-mongodb-driver-with-php-on.html and I have followed it faithfully. I have also installed the commandline tools as referenced here: Unable to install mongodb php driver on mac os 10.9.
Relavent php.ini lines:
include_path = ".:/usr/lib/php/pear"
extension=mongo.so
any help appreciated. Thanks, Brian
I hanged up for a while in the same situation on ubuntu, then I just tried
1) In your phpinfo() screen, make sure the Configuration file Path and Loaded Configuration File match the PHP file you are editing. If not, then find the correct php.ini and add the mongo.so extension.
2) In your phpinfo() screen, look at the extension_dir value and confirm that mongo.so exists in that directory. If not, find the mongo.so file and copy it to this directory.
3) Restart your web server.
4) If it's still not working, take a look at the web server & php logs for clues as to why the extension might not be loading.
from Error enabling MongoDB module
All was ok on my side, but still I kept getting,
$ php --re mongo
Exception: Extension mongo does not exist
then I checked with this test script and was able to connect to mongoDB.
<?php
try {
// open connection to MongoDB server
$conn = new Mongo('localhost');
// access database
$db = $conn->test;
// access collection
$collection = $db->items;
// execute query
// retrieve all documents
$cursor = $collection->find();
// iterate through the result set
// print each document
echo $cursor->count() . ' document(s) found. <br/>';
foreach ($cursor as $obj) {
echo 'Name: ' . $obj['name'] . '<br/>';
echo 'Quantity: ' . $obj['quantity'] . '<br/>';
echo 'Price: ' . $obj['price'] . '<br/>';
echo '<br/>';
}
// disconnect from server
$conn->close();
} catch (MongoConnectionException $e) {
die('Error connecting to MongoDB server');
} catch (MongoException $e) {
die('Error: ' . $e->getMessage());
}
?>
Therefore try the script and if you are able to connect without errors, forget about the extension :).
I have freeswitch running on a Centos 6 remote server and I have XAMPP installed on the local machine ( windows 7 x64 PHP Version 5.3.8 ) for testing. I am trying to use Mod event socket ( http://wiki.freeswitch.org/wiki/Event_Socket ) to connect to freeswitch from a php script, using Event Socket Library ( http://wiki.freeswitch.org/wiki/Event_Socket_Library ).
My php script is:
#!/usr/bin/php
<?php
require_once('ESL.php');
$command = "show channels";
$sock = new ESLconnection('xxx.xxx.xxx.xxx', '8021', 'fsAdmin');
$res = $sock->api($command);
printf("%s\n", $res->getBody());
?>
where xxx.xxx.xxx.xxx is the freeswitch server's address.
I have two problems:
in Windows I seem to need a php_ESL.dll which I can't find anywhere. The only files I've got are:
ESL.php
esl_wrap.cpp
Makefile
php_ESL.h
I have PHP Version 5.3.8 and in the ESL.php is used the dl() function and I get: Fatal error: Call to undefined function dl() in C:\xampp\htdocs\phpesl\ESL.php
+The dl() function is called in ESL.php:
// Try to load our extension if it's not already loaded.
if (!extension_loaded("ESL")) {
if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
if (!dl('php_ESL.dll')) return;
} else {
// PHP_SHLIB_SUFFIX is available as of PHP 4.3.0, for older PHP assume 'so'.
// It gives 'dylib' on MacOS X which is for libraries, modules are 'so'.
if (PHP_SHLIB_SUFFIX === 'PHP_SHLIB_SUFFIX' || PHP_SHLIB_SUFFIX === 'dylib') {
if (!dl('ESL.so')) return;
} else {
if (!dl('ESL.'.PHP_SHLIB_SUFFIX)) return;
}
}
}
Does anybody know how to solve this or encountered the same problem ?
Thanks.
probably the least effort would be to have a Linux webserver somewhere - for example, in a virtual machine on your windows PC
In your issue I think dl function disabled in the php.ini file.
phpmotion requires these PHP settings:
Thread saftery= disabled
enable_dl = On
safe_mode = off
I'm trying to run the example Gearman worker from their documentation (see below), but every time I do I get a slew of errors in my Gearman log file like this: FATAL [ 0] gearman_packet_unpack_header:invalid command value. When I run the Gearman client (again, their own example), it doesn't seem to change anything. Nothing happens.
Here is the sample worker code that is failing
# Create our worker object.
$worker= new GearmanWorker();
# Add default server (localhost).
$worker->addServer();
# Register function "reverse" with the server.
$worker->addFunction("reverse", "reverse_fn");
while (1)
{
print "Waiting for job...\n";
$ret= $worker->work();
if ($worker->returnCode() != GEARMAN_SUCCESS)
break;
}
# A much simple reverse function
function reverse_fn($job)
{
$workload= $job->workload();
echo "Received job: " . $job->handle() . "\n";
echo "Workload: $workload\n";
$result= strrev($workload);
echo "Result: $result\n";
return $result;
}
>php -i:
extension version 1.0.2
libgearman version 0.29
Default TCP Host localhost
Default TCP Port 4730
>gearmand -V:
gearmand 0.29
How do I correctly configure Gearman to work? libgearman is the same version as gearmand, and my PECL extension is the most-recent stable version. I'm not sure what else to try.
As far as I was able to tell, the PECL extension for Gearman as version 1.0.2 does not work with Gearman version 0.29. I updated Gearman and libgearman both to version 0.33, and as soon as I did my extension was working.