OpenX: Error messages / troubleshooting

PHP Strict Standards Error after PHP Upgrade 5.4.x

After upgrading to PHP 5.4.x OpenX will show the following errors:

 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

You would solve this problem correctly by modifying the methods:

function setErrorHandling($txt){

to

public static function setErrorHandling($txt){

Solution

This however would take way too much time. And you would have to those modifications again with every future OpenX update. A faster way is to simply change the error_reporting in order to disable the Strict Notifications. To do so, simply edit the init.php file in your root directory:

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

Don’t forget to update the maintenance script. It’s called by a cronjob and the init.php file is not included there.

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

Update this file:

vi /www/openx-2.8.10/scripts/maintenance/maintenance.php

And add the error_reporting to the top of the file.

#!/usr/bin/php -q
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED & ~E_STRICT);

Fatal error: Class ‘MAX_ErrorHandler’ not found in  on line 143

This error is also caused by the PHP Strict Standards issue. To fix this, simply change the error_reporint settings as explained above.

Blank Statistics Page in PHP Version 5.4.x

After a PHP Upgrade to version 5.4.x the openx statistics page won’t display anymore. You only get a white page. No errors are displayed anywhere.

The output stops in this file

www/admin/stats.php

after the line:

// Prepare the stats controller, and populate with the stats
$oStatsController = &OA_Admin_Statistics_Factory::getController($entity . "-" . $breakdown, $aParams);

The next stop is in the 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);

We see, that inside the method _instantiateController the error output is disabled. Therefore we are unable to see the reason for stats problem:

    function _instantiateController($file, $class, $aParams = null)
    {
        if (!@include_once $file)

When I remove the @, we will receive the information we need:

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

Change the lines as described below on line 292:

            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
                }
            }

And also on line 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
                }
            }

And also in this file:

vi lib/OA/Admin/Statistics/Delivery/CommonHistory.php 

Line 160:

    function prepare(&$aParams, $link = '')
    {
/* replaced by teslina
        parent::prepare(&$aParams);
*/
        parent::prepare($aParams);
// eof teslina

Finally… the stats page is running again 🙂

OpenX Upgrade Problems

Installation stops with an error: Duplicate entry ‘oxMarket_publisher_account_id’ for key ‘PRIMARY’ 

The upgrade process ends with the following error:

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

The problem is caused by the function call of storeMarketAccountAssocData() during the upgrade process:

    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;
    }

This function tries to insert those 2 values into the database – regardless if they exists or not.

Also werden in der DB diese Werte eingefügt – und es wird anscheinend nicht darauf geachtet, ob sie bereits existieren.

In theory, everything is done properly, because the set function checks whether a variable isset or not:

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();
        }

It could be a problem, that the function _getAll receives the variables per default from the cache  and not from the database.

function &_getAll($fromCache = true)

I have tried this workaround – but unfortunately it didn’t work.

vi lib/OA/Dal/ApplicationVariables.php
    function set($name, $value)
    {
        // Load the cache
        $aVars = &OA_Dal_ApplicationVariables::_getAll(false);

The cause for this problem is probably, that in my current OpenX version both values for oxMarket_publisher_account_id and oxMarket_api_key are NULL. And therefore OpenX thinks, that those values are notset?

Solution

So simply delete those keys from the DB and restart the installation.

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';

It is important that you continue after this error as followed:

  1. Delete the installation directory openx-2.8.10 completely.
  2. Restore the database from your previous backup.
  3. Remove the mentioned values from the database.
  4. Restart the upgrade process.

Ads are not being displayed / empty with https / SSL

The adserver is running with SSL / https, but the ads are empty. This can happen, if you are using HTML Banners. If there are links to (unsafe http://) images included, those ads will be ignored by revive/openx.

Solution

Fix the HTML Banner Code:

<div class="spreadshirt shared_product" style="text-align:center;"><a href="{clickurl}"><img src="http://[...]

Switch to https:

<div class="spreadshirt shared_product" style="text-align:center;"><a href="{clickurl}"><img src="https://[...]

After this change, the ads will be deilvered again.

 

  • kumanan
    #1 written by kumanan 5 years ago

    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

  • Thorsten Biedenkapp
    #2 written by Thorsten Biedenkapp 4 years ago

    Thank you very much for these very helpful tips! Great tutorial, really saved my day!

  • Brian Royce
    #3 written by Brian Royce 4 years ago

    I could use some help – I would like to talk to you about getting openx working on plesk. I have not been able to do it. I have php 5.3.22 and the installer doesn’t even work. Contact me please.

    • teslina
      #4 written by teslina 4 years ago

      Hello Brian – please check your email. I have just sent you a message.

  • Roger
    #5 written by Roger 4 years ago

    Thanks for sharing the hacks to make OpenX work with 5.4!

  • Mix
    #6 written by Mix 4 years ago

    Thanks you too much! This helped me a lot!

    PS: why, after 2 month the openx staff haven’t done an update to solve that yet?

  • mikeymike
    #7 written by mikeymike 4 years ago

    thanks the stats page works for me now…
    from your post…
    “Blank Statistics Page in PHP Version 5.4.x”

  • Marek
    #8 written by Marek 4 years ago

    Thanks a lot. For a few days I collected 40 GB error_log, now everything is back to normal

  • Matt
    #9 written by Matt 4 years ago

    Thanks, but these didn’t work for me. Got the stats page working like above, but none of the ads are showing still.

  • Toni
    #10 written by Toni 4 years ago

    Thank you, gràcies!!
    It’s work perfect !!

  • BeRaf
    #11 written by BeRaf 4 years ago

    Error after PHP Upgrade 5.4 fix work perfectly

    Centos 6.2
    Php 5.4
    openx-2.8.11

    THANKS

  • Twam
    #12 written by Twam 4 years ago

    I just updated to PHP 5.4.x and started getting these errors but the problem is i can’t even log into my admin area, OpenX just keeps giving me this error message “You need to enable cookies before you can use OpenX” among the other PHP errors being displayed at the top of the page. Ads are still being displayed but i have no way to login :/

    • Teslina
      #13 written by Teslina 4 years ago

      Hello Twam
      Have you checkt your session handling? Are all (session-) folder permissions set correctly? Have you already updated your OpenX core files in order to disable the strict standards error messages? Maybe you should also delete your browser cookies. This helps sometimes 😉

  • Twam
    #14 written by Twam 4 years ago

    Hi Teslina,
    I redid all the fixes as you posted above and all seems to be working as it should. THANKS, Huge Help !! 🙂

  • Gecko
    #15 written by Gecko 4 years ago

    Thanks for the fix!

  • Marcus Floyd
    #16 written by Marcus Floyd 4 years ago

    Just wanted to say thanks for this. I’ve been without stats for a long time. These fixes work for php 5.5 as well. You are the man!

  • Christopher
    #17 written by Christopher 4 years ago

    This worked perfectly for fixing PHP errors and the Statistics page not displaying with OpenX 2.8.11 on PHP 5.4, but I’m having one issue still.

    For some reason all my Dashboard widgets under Home are empty. They are all just white boxes with nothing in them. I haven’t been able to find anything Googling this issue. Do you have any idea what would cause this, and if so can you recommend a solution?

    Thank you so much!

    • Teslina
      #18 written by Teslina 4 years ago

      Glad, I could help 😉

      Hmm… As for me, I have disabled the dashboard on my OpenX – so I don’t know anything about this problem. However, this sounds more like a Javascript issue. Have you checked your dashboard with Firebug?

      If you can’t fix it yourself, I could look into this if you like. You can contact me privately using this contact form: http://www.teslina.com/en/kontakt/

  • Dave
    #19 written by Dave 4 years ago

    a BIG help, thank you so much!

  • Juan
    #21 written by Juan 4 years ago

    Thankyou, your aid has been very useful for me, My ads now works fine.

  • Shantanu
    #22 written by Shantanu 4 years ago

    As in the comment http://www.teslina.com/tutorials/openx/fehlermeldungen-problemlosungen/#comment-5585
    Even i am facing the same issue, my dashboard is also blank.
    Can anyone help me out.

    • Teslina
      #23 written by Teslina 4 years ago

      Hello Shantanu
      Have your checked your dashboard with Firebug? Does it report any errors?

      • Shantanu
        #24 written by Shantanu 4 years ago


        Teslina:

        Hello Shantanu
        Have your checked your dashboard with Firebug? Does it report any errors?

        I checked my dashboard, i just happen to notice that all the iframes in the widgets are loaded blank, completely empty and this is nothing strange as such that caught my attention.

      • Shantanu
        #25 written by Shantanu 4 years ago

        Completely Empty –

      • Shantanu
        #26 written by Shantanu 4 years ago

        Sorry for the blank comments, i dint know that the comments don’t render HTML code. (Trying the last time: shows empty iframe, with empty html, head, body tags):

      • Shantanu
        #27 written by Shantanu 4 years ago

        Also i got the following errors in the inventory setup:

        Strict Standards: Non-static method OA::debug() should not be called statically, assuming $this from incompatible context in /home/server-name/public_html/OpenX/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 /home/server-name/public_html/OpenX/lib/OA.php on line 158

        Strict Standards: Non-static method Log::factory() should not be called statically, assuming $this from incompatible context in /home/server-name/public_html/OpenX/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 /home/server-name/public_html/OpenX/lib/OA.php on line 165

        Strict Standards: Non-static method OX_Admin_Timezones::getTimezone() should not be called statically, assuming $this from incompatible context in /home/server-name/public_html/OpenX/lib/OA.php on line 198

        Strict Standards: Non-static method OA::debug() should not be called statically, assuming $this from incompatible context in /home/server-name/public_html/OpenX/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 /home/server-name/public_html/OpenX/lib/OA.php on line 158

        Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /home/server-name/public_html/OpenX/lib/OA.php on line 165

        Strict Standards: Non-static method OX_Admin_Timezones::getTimezone() should not be called statically, assuming $this from incompatible context in /home/server-name/public_html/OpenX/lib/OA.php on line 198

        Strict Standards: Non-static method OA::debug() should not be called statically, assuming $this from incompatible context in /home/server-name/public_html/OpenX/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 /home/server-name/public_html/OpenX/lib/OA.php on line 158

        Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /home/server-name/public_html/OpenX/lib/OA.php on line 165

        Strict Standards: Non-static method OX_Admin_Timezones::getTimezone() should not be called statically, assuming $this from incompatible context in /home/server-name/public_html/OpenX/lib/OA.php on line 198

        Strict Standards: Non-static method OA::debug() should not be called statically, assuming $this from incompatible context in /home/server-name/public_html/OpenX/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 /home/server-name/public_html/OpenX/lib/OA.php on line 158

        Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /home/server-name/public_html/OpenX/lib/OA.php on line 165

        Strict Standards: Non-static method OX_Admin_Timezones::getTimezone() should not be called statically, assuming $this from incompatible context in /home/server-name/public_html/OpenX/lib/OA.php on line 198

        Strict Standards: Non-static method OA::debug() should not be called statically, assuming $this from incompatible context in /home/server-name/public_html/OpenX/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 /home/server-name/public_html/OpenX/lib/OA.php on line 158

        Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /home/server-name/public_html/OpenX/lib/OA.php on line 165

        Strict Standards: Non-static method OX_Admin_Timezones::getTimezone() should not be called statically, assuming $this from incompatible context in /home/server-name/public_html/OpenX/lib/OA.php on line 198

  • Twayne
    #29 written by Twayne 3 years ago

    I’m a bit confused. Where is the init.php file in your root directory. What root directory are we talking about? Is this the root of the install folder where openx is installed? IE website.com/ads ?

    Also, where in the init.php file should the referenced code be added or where would the code be found that should be removed?

    Solution
    This however would take way too much time. And you would have to those modifications again with every future OpenX update. A faster way is to simply change the error_reporting in order to disable the Strict Notifications. To do so, simply edit the init.php file in your root directory:

    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
    Don’t forget to update the maintenance script. It’s called by a cronjob and the init.php file is not included there.

    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
    Update this file:

    vi /www/openx-2.8.10/scripts/maintenance/maintenance.php
    And add the error_reporting to the top of the file.

    #!/usr/bin/php -q
    error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING & ~E_DEPRECATED & ~E_STRICT);
    – See more at: http://www.teslina.com/en/tutorials/openx/fehlermeldungen-problemlosungen/#Solution

    • Teslina
      #30 written by Teslina 3 years ago

      as for openx-2.8.10, the init.php file is located in the root directory of openx. so, when you extract the openx.tar.gz, it’s located here:

      openx-2.8.0/init.php

      if you have renamed the openx folder into ads, it would be here

      ads/init.php

  • Gizmo
    #31 written by Gizmo 3 years ago

    thanks still solved most problems,

    but I still get this error on stats.php:

    Parse error: syntax error, unexpected ‘private’ (T_PRIVATE) in /home/topadser/public_html/openx/lib/OA/Admin/Statistics/Delivery/CommonEntity.php on line 550

    any idea how to solve this?

    • Teslina
      #32 written by Teslina 3 years ago

      What version of openX have you installed? Since this is a syntax error: have you edited this file (CommonEntity.php) manually? This looks more like a self-made problem 😉

  • opk
    #33 written by opk 3 years ago

    Hi there! I went through the whole process in order to move openx and also fixed the errors by applying your excellent fixes above. My banners are normally displayed and I have full access to administration. The only issue is that when trying to upload a banner, it isn’t saved. When returning to the banner properties tab the file is missing. Can you help please? Thanks.

    • Teslina
      #34 written by Teslina 3 years ago

      I had a similar problem once. In my case it was a simple cache issue. Have you deleted your browser’s cache? Maybe this helps?

  • opk
    #35 written by opk 3 years ago

    It must be related with permissions, because every time I log in the error pop-up appears. I have activated the error reporting and it reads now

    Array ( [filePerms] => File permission errors have been detected, and must be fixed before you can continue.
    To fix the errors on a Linux system, try typing in the following command(s):
    chmod -R a+w public_html/openximages

    I have tried to change permissions to all combinations incl. 777, nothing changes. Also changed the folder and put it outside openx folder…

    It’s a very serious issue, since I can’t upload new banners and having a huge ad database delivered to many sites, starting from scratch is not an option…

    Thanks for helping.

    • Teslina
      #36 written by Teslina 3 years ago

      hmmmm… have you set the right owner for this folder? (chown)

  • C0NFUS3D
    #37 written by C0NFUS3D 3 years ago

    You’re a life saver! Thanks for this post!

  • Chris
    #38 written by Chris 3 years ago

    Really helpfull!
    Thanks

  • David
    #39 written by David 3 years ago

    Hello,

    I have this problem running maintenance script. All other tips worked well:

    PEAR Error

    OA_XML_RPC_Client: RPC server did not send response before timeout.

    Version 2.8.7

  • Matt
    #40 written by Matt 2 years ago

    Most excellent fixes…thank you. I have an interesting problem that someone here might know the answer to off the top of their heads.

    I have two websites that are fed OpenX ads from a third site. We recently upgraded all three to SSL and – after rewriting the invocation codes – everything appeared to be running securely. That is, until I noticed that there were no HTML banners displaying. All other ads are fine. The HTML ads are all calling https: correctly and the Probability shows that they should be displaying with the others.

    I have implemented the raw ad codes (all types) on test pages…but still no HTML ads. Anyone run into this before? I have been scouring the code and internet looking for clues without any luck.

    I am running OpenX v2.8.8 on Apache 2.4.17, PHP 5.4.45 and MySQL 5.5.46-cll.

    Thank you!
    -Matt

    • Teslina
      #41 written by Teslina 2 years ago

      Hello Matt
      Thank you 😉
      Yes, I know this issue and had the same problem. The solution is simple: The HTML Content of the ad has to be secure as well. So, all html tags for images/media need to be pointed to https:// instead of http://. That’s it. 🙂

  • Chris
    #42 written by Chris 1 year ago

    Hello,

    after having implemented your modifications on my OpenX 2.8.11 version, the system is running great with PHP 5.4 beside one topic.
    I have some locally saved banners and they are not shown yet (only the ALT tag is displayed on the website).
    I have also shifted the image folder outside the OpenX folder, but this should not be the issue, because the ALT-Text is displayed, right?
    Do you know how I can fix this as well?
    Thanks in advance.

    Chris

    • Teslina
      #43 written by Teslina 1 year ago

      Hi Chris
      Have you tried deleting the delivery cache? This could fix the issue… (just delete all the files in var/cache directory of openx)

  • Gork
    #44 written by Gork 1 year ago

    Thank you so so much!!

  • *

    You may use these HTML tags: <a> <abbr> <acronym> <b> <blockquote> <cite> <code> <del> <em> <i> <q> <s> <strike> <strong>

  • Comment Feed for this Post
Go to Top