OpenX: Fehlermeldungen / Problemlösungen
PHP Strict Standards Error nach PHP Upgrade 5.4.x
Ab PHP 5.4.x kommen bei OpenX folgende Fehler:
Strict Standards: Non-static method PEAR::setErrorHandling() should not be called statically in /www/openx-2.8.10/lib/Max.php on line 222 Strict Standards: Non-static method OA::debug() should not be called statically, assuming $this from incompatible context in /www/openx-2.8.10/lib/max/ErrorHandler.php on line 134 Strict Standards: Non-static method Log::singleton() should not be called statically, assuming $this from incompatible context in /www/openx-2.8.10/lib/OA.php on line 158 Strict Standards: Non-static method Log::factory() should not be called statically, assuming $this from incompatible context in /www/openx-2.8.10/lib/pear/Log.php on line 199 Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /www/openx-2.8.10/lib/OA.php on line 165 Strict Standards: Non-static method OA::debug() should not be called statically, assuming $this from incompatible context in /www/openx-2.8.10/lib/max/ErrorHandler.php on line 134
Korrekt würde man dieses Problem lösen, indem man die Methoden entsprechend abändert:
function setErrorHandling($txt){
nach
public static function setErrorHandling($txt){
Lösung
Da dies jedoch sehr viel Zeit in anspruch nehmen würde und man diese Anpassungen voraussichtlich noch länger bei jedem OpenX Update erneut machen müsste, ist die einfachste Lösung einfach das error_reporting anzupassen und Strict Meldungen auszublenden. Dazu einfach im init.php im root Verzeichnis folgendes anpassen:
vi init.php
/* replaced by teslina - PHP Strict Standards Fix error_reporting(E_ALL ^ E_NOTICE ^ E_WARNING ^ E_DEPRECATED); */ error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED & ~E_STRICT); // eof teslina
Nun muss man auch noch das maintenance Script berücksichtigen, da dieses ja per Cronjob ausgeführt wird und dieselben Errors ausspuckt:
Strict Standards: Non-static method OX_Admin_Timezones::getTimezone() should not be called statically in /www/openx-2.8.10/scripts/maintenance/maintenance.php on line 46
Also File anpassen:
vi /www/openx-2.8.10/scripts/maintenance/maintenance.php
einfach gleich zuoberst das error_reporting hinzufügen.
#!/usr/bin/php -q
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED & ~E_STRICT);
ausserdem noch in folgenden files anpassen – einfach jeweils nach error_reporting suchen:
openx-2.8.10/www/delivery/lg.php openx-2.8.10/www/delivery/ajs.php
Fatal error: Class ‚MAX_ErrorHandler‘ not found in on line 143
Dieser Fehler wird vom PHP Strict Standards Problem ausgelöst. Einmal wird jedoch nicht der oben genannte Error ausgegeben, an anderen Tagen werden die Strict Fehler ausgegeben. Lösen lässt sich beides schnell, indem man das error_reporting anpasst (siehe oben).
Statistik Seite wird nicht angezeigt (weisse Seite)
Nach dem Update auf PHP Version 5.4.x wird die Statistik Seite nicht mehr angezeigt. Es werden auch keine Fehler ausgegeben.
Der Output stoppt im File
www/admin/stats.php
nach dieser Zeile
// Prepare the stats controller, and populate with the stats $oStatsController = &OA_Admin_Statistics_Factory::getController($entity . "-" . $breakdown, $aParams);
Der nächste Haltepunkt ist im File
lib/OA/Admin/Statistics/Factory.php
function &getController($controllerType = '', $aParams = null) { // Instantiate & return the required statistics class $result = OA_Admin_Statistics_Factory::_getControllerClass($controllerType, $aParams, $class, $file); if (PEAR::isError($result)) { return $result; } // To allow catch errors and pass it out without calling error handler PEAR::pushErrorHandling(null); $oStatsController = OA_Admin_Statistics_Factory::_instantiateController($file, $class, $aParams);
In der Methode _instantiateController wird nun die Fehlerausgabe auskommentiert. Daher sehen wir nicht, wo das Problem liegt:
function _instantiateController($file, $class, $aParams = null)
{
if (!@include_once $file)
Entfernen wir das @ bekommen wir endlich eine Fehlerausgabe mit der wir was anfangen können:
Fatal error: Call-time pass-by-reference has been removed in openx-2.8.10/lib/OA/Admin/Statistics/Delivery/CommonEntity.php on line 292
So, das muss nun wie folgt angepasst werden.
if (array_search('ad_id', $aggregates) !== false) { $this->childrendata['ad_id'] = Admin_DA::fromCache('getAds', $aParams); // Plugins can set their own ads in the array foreach ($this->aPlugins as $oPlugin) { /* replaced by teslina $oPlugin->mergeAds(&$this->childrendata['ad_id']); */ $oPlugin->mergeAds($this->childrendata['ad_id']); // eof teslina } }
Das gleiche noch auf Zeile 322:
// Plugins can set their own zones in the array foreach ($this->aPlugins as $oPlugin) { /* replaced by teslina $oPlugin->mergeZones(&$this->childrendata['zone_id']); */ $oPlugin->mergeZones($this->childrendata['zone_id']); // eof teslina } }
Dann noch im File:
vi lib/OA/Admin/Statistics/Delivery/CommonHistory.php
Zeile 160:
function prepare(&$aParams, $link = '') { /* replaced by teslina parent::prepare(&$aParams); */ parent::prepare($aParams); // eof teslina
So.. und nun läuft die Statistik Page wieder!
OpenX Upgrade Probleme
Installation wird abgebrochen: Duplicate entry ‚oxMarket_publisher_account_id‘ for key ‚PRIMARY‘
Der Upgrade Prozess endet mit diesem Fehler:
An error occurred while accessing the database Due to a problem with the database OpenX couldn't retrieve or store data. If this problem is reproducable it might be caused by a bug in OpenX. Please report the following information to the creators of OpenX. Also try to describe the actions that led to this error as clearly as possible.
Version: | OpenX v2.8.10 |
PHP/DB: | PHP 5.4.6 / MySQL 5.5.20-log |
Page: | /www/admin/install.php |
Error: | Duplicate entry ‚oxMarket_publisher_account_id‘ for key ‚PRIMARY‘ |
Query: | INSERT INTO phpads_application_variable (name ) VALUES ('oxMarket_publisher_account_id' ) |
$_POST: | Array ( [_qf__install-db-form] => [token] => [action] => database [save] => Continue » ) |
$_GET: | Empty |
Das Problem ist, dass während dem Upgrade die funktion storeMarketAccountAssocData() aufgerufen wird. Die sieht so aus:
public static function storeMarketAccountAssocData($accountUuid, $apiKey) { // store in application variable if( !PEAR::isError(OA_DB::singleton())) { return OA_Dal_ApplicationVariables::set('oxMarket_publisher_account_id', $accountUuid) && OA_Dal_ApplicationVariables::set('oxMarket_api_key', $apiKey); } return false; }
Also werden in der DB diese Werte eingefügt – und es wird anscheinend nicht darauf geachtet, ob sie bereits existieren. Theoretisch würde alles richtig gemacht werden, denn die set Funktion prüft, ob eine Variabel existiert, bevor sie sie setzt:
lib/OA/Dal/ApplicationVariables.php
function set($name, $value) { // Load the cache $aVars = &OA_Dal_ApplicationVariables::_getAll(); $doAppVar = OA_Dal::factoryDO('application_variable'); $doAppVar->name = $name; $doAppVar->value = $value; if (isset($aVars[$name])) { $result = $doAppVar->update(); } else { $result = $doAppVar->insert(); }
Das Problem könnte sein, dass die Funktion _getAll die Variabeln per Default aus dem Cache holt und nicht aus der DB
function &_getAll($fromCache = true)
Hab diesen Workaround ausprobiert, er funktioniert jedoch leider NICHT:
vi lib/OA/Dal/ApplicationVariables.php
function set($name, $value)
{
// Load the cache
$aVars = &OA_Dal_ApplicationVariables::_getAll(false);
Dann liegt es vielleicht daran, dass in meiner aktuellen OpenX Version die beiden Werte oxMarket_publisher_account_id und oxMarket_api_key den Wert NULL haben. Eventuell hat OpenX mit NULL Values ein Problem und meint daher, dass die Values nicht gesetzt sind?
Lösung
Daher, lösche ich diese beiden Keys aus der DB und führe die Installation erneut aus.
DELETE FROM `OpenX`.`phpads_application_variable` WHERE `phpads_application_variable`.`name` = 'oxMarket_api_key'; DELETE FROM `OpenX`.`phpads_application_variable` WHERE `phpads_application_variable`.`name` = 'oxMarket_publisher_account_id';
Wichtig ist, dass man nach diesem Fehler so vorgeht:
- Install Verzeichnis openx-2.8.10 komplett löschen.
- Datenbank Backup zurückladen
- Datenbank anpassen & Werte löschen
- Upgrade erneut starten.
Ads werden mit https / SSL nicht angezeigt
Der Adserver läuft mit SSL / https, es werden aber keine Ads angezeigt. Das kann z.B. dann passieren, wenn man HTML Banner eingebunden hat. Wenn die noch Links zu Bildern drin haben, die auf unsichere Seiten gehen, werden diese Ads vom Adserver ignoriert und gar nicht erst augeliefert, da dies zu Fehlermeldungen beim User kommen könnte.
Lösung
HTML Banner Code auf https korrigieren:
<div class="spreadshirt shared_product" style="text-align:center;"><a href="{clickurl}"><img src="http://[...]
Korrekt ist:
<div class="spreadshirt shared_product" style="text-align:center;"><a href="{clickurl}"><img src="https://[...]
Danach werden die Ads auch auf sicheren Seiten angezeigt.
Hi,
very very thanks…….. please accept my thanks.. it is works for me now… i am searching this issue for the past 2 days to fix.
regards
kums