Fixing OpenX Permission Error Warning

Published by John on July 9, 2012 Under OpenX

I was working on a site with OpenX installed today and after doing an upgrade, got the following warning message regarding permissions:

Error: File permission errors detected. These may impact the accurate delivery of your ads, See the debug.log file for the list of unwritable files

Of course, there was not a list of unwritable files in debug.log, even after deleting the log and re-running maintenance.

So, I did a quick grep to find where that error was coming from:

grep -lnR 'Error: File permission errors detected.' /public_html/openx/

Result: /public_html/openx/lib/OX/Extension/authentication/authentication.php

As you can see, that text is published in authentication.php on line #166, see below:

        foreach ($aSysInfo as $env => $vals) {
            $errDetails = '';
            if (is_array($vals['error']) && !empty($vals['error'])) {
                if ($env == 'PERMS') {
                   // Just note that some file/folders are unwritable and that more information can be found in the debug.log
                    OA_Admin_UI::queueMessage('Error: File permission errors detected.<br />These <em>may</em> impact the accurate delivery of your ads,<br />See the debug.log file for the list of unwritable files', 'global', 'error', 0);
                } else {
                    foreach ($vals['error'] as $key => $val) {
                        $errDetails .= '<li>' . htmlspecialchars($key) . ' &nbsp; => &nbsp; ' . htmlspecialchars($val) . '</li>';
                    }
                    phpAds_Die( ' Error: ' . $err, $errDetails );
                }
            }
        }

Identifying The Problem

In order to better see what was going on, I added “print_r($vals[‘error’]);” to line #5, right after ‘($env == ‘PERMS’) ‘ See below:

        foreach ($aSysInfo as $env => $vals) {
            $errDetails = '';
            if (is_array($vals['error']) && !empty($vals['error'])) {
                if ($env == 'PERMS') {
                   print_r($vals['error']);
                   // Just note that some file/folders are unwritable and that more information can be found in the debug.log
                    OA_Admin_UI::queueMessage('Error: File permission errors detected.<br />These <em>may</em> impact the accurate delivery of your ads,<br />See the debug.log file for the list of unwritable files', 'global', 'error', 0);
                } else {
                    foreach ($vals['error'] as $key => $val) {
                        $errDetails .= '<li>' . htmlspecialchars($key) . ' &nbsp; => &nbsp; ' . htmlspecialchars($val) . '</li>';
                    }
                    phpAds_Die( ' Error: ' . $err, $errDetails );
                }
            }
        }

After logging in and out, I got the error message + the following, which correctly identified the folders with permission errors. I have not seen the error since, just make sure to revert the above changes. Of course, why the plugins folders need write permission still needs to be investigated…

You may need to run the maintence script for it to go away though and or wait for it to run automatically.

/public_html/openx/plugins
/public_html/openx/www/admin/plugins
/public_html/openx/www/images

Update 01/09/2014: Permission Errors with the Revive Adserver

OpenX is now know as the Revive Adserver after being sold in September 2013. The above still works though and can help identify missing incorrect permissions.


8 Comments |

Comments:

  1. Pedro on Aug 03, 2012

    Thanks john, this really help me. The default openx message was not helpful at all and I didn’t want to give openx full 777 permissions.

  2. Stacy on Apr 15, 2013

    Thanks for posting this. It also helped me.

  3. Austen on May 15, 2013

    This was the ticket! Thanks!

  4. john on May 16, 2013

    Glad this helped you. I have had to use this process a couple of times to debug openx errors, as the logging mechanism and default reporting leaves something to be desired. Adding the above code is a quick and easy way to see what the issue is.

  5. Howard on Oct 22, 2013

    Something else to check using the above method:

    this revealed that the path was not correct (unsure why) for banner storage.

    Check Config > Global > Banner Storage Settings – mine was showing a path which did not exist NOT a permission error. Changed to correct path and problem went away.

  6. mike on Nov 10, 2013

    thx this worked for me
    I couldn’t pload a local banner to the webserver
    now all works and no error messages

  7. Juanma on Nov 21, 2013

    Thank you very much for your solution. It works for my instalation and release me for a lot of headaches!

  8. Pawel on Jan 08, 2014

    Great! Thanks a lot John!

Add a Comment