revival-adserver /var permissions

Even after running chmod -R a+w on adserver/var, still getting this problem.

Looks like it is a problem with PHP

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 /home/a2z/public_html/adserver/var
For more help, please see the Revive Adserver documentation.
Status: 
Active

Comments

Howdy -- thanks for contacting us!

What PHP Execution Mode is it that you're using there?

You can see that in Server Configuration -> Website Options.

That's odd, because Virtualmin explicitly makes that var directory writable as part of the install. Also, if it's owned by the domain owner and PHP scripts run in FPM mode, they should also have permissions to write to it.

Could you try creating a file named "test.php" in the public_html folder, and for it's contents, add the following:

<?php phpinfo(); ?>

Then, can you share the resulting URL with us so we can see the phpinfo output? Thanks!

Yup, that looks good -- it's set to use FCGID in Virtualmin, and I can see in that output that FCGID is working.

The next step would be to look at the folder in question -- what output do you see when running these commands:

ls -la /home/a2z/public_html/adserver/var
ls -la /home/a2z/public_html/adserver
bislinks's picture
Submitted by bislinks on Mon, 10/28/2019 - 18:05 Pro Licensee

[a2z@edge adserver]$ ls -la /home/a2z/public_html/adserver/var
total 96
drwxrwxrwx 5 a2z a2z   153 Oct 27 05:18 .
drwxr-xr-x 9 a2z a2z  4096 Oct 28 16:22 ..
lrwxrwxrwx 1 a2z a2z    56 Oct 27 04:45 a2z.blue.conf.php -> /home/a2z/public_html/adserver/var/www.a2z.blue.conf.php
drwxrwxrwx 2 a2z a2z  4096 Oct 27 04:56 cache
-rw-rw-rw- 1 a2z a2z 60617 Oct 28 16:27 debug.log
-rwxrwxrwx 1 a2z a2z   196 Oct 27 04:45 .htaccess
-rw-rw-rw- 1 a2z a2z 17784 Oct 28 16:27 install.log
drwxrwxrwx 4 a2z a2z    58 Oct 27 04:45 plugins
drwxrwxrwx 2 a2z a2z  4096 Oct 27 04:56 templates_compiled
-rwxrwxrwx 1 a2z a2z     0 Oct 27 04:45 UPGRADE
[a2z@edge adserver]$ ls -la /home/a2z/public_html/adserver
total 192
drwxr-xr-x  9 a2z a2z  4096 Oct 28 16:22 .
drwxr-xr-x  7 a2z a2z   130 Oct 27 04:55 ..
-rwxr-x---  1 a2z a2z   598 Oct 27 04:45 adclick.php
-rwxr-x---  1 a2z a2z   599 Oct 27 04:45 adframe.php
-rwxr-x---  1 a2z a2z   598 Oct 27 04:45 adimage.php
-rwxr-x---  1 a2z a2z   599 Oct 27 04:45 adjs.php
-rwxr-x---  1 a2z a2z   598 Oct 27 04:45 adlayer.php
-rwxr-x---  1 a2z a2z   599 Oct 27 04:45 adpopup.php
-rwxr-x---  1 a2z a2z   599 Oct 27 04:45 adview.php
-rwxr-xr--  1 a2z a2z     0 Oct 27 04:45 adx.js
-rwxr-x---  1 a2z a2z   600 Oct 27 04:45 adxmlrpc.php
-rwxr-xr--  1 a2z a2z  1447 Oct 27 04:45 composer.json
-rwxr-xr--  1 a2z a2z 24762 Oct 27 04:45 composer.lock
-rwxr-x---  1 a2z a2z 11607 Oct 27 04:45 constants.php
-rwxr-xr--  1 a2z a2z  1828 Oct 27 04:45 COPYRIGHT.txt
-rwxr-xr--  1 a2z a2z   215 Oct 27 04:45 crossdomain.xml
drwxr-xr-x  6 a2z a2z  4096 Oct 27 04:45 etc
-rwxr-x---  1 a2z a2z  1062 Oct 27 04:45 index.php
-rw-rw-r--  1 a2z a2z    20 Oct 28 16:22 info.php
-rwxr-x---  1 a2z a2z  4657 Oct 27 04:45 init-delivery-parse.php
-rwxr-x---  1 a2z a2z  2975 Oct 27 04:45 init-delivery.php
-rwxr-x---  1 a2z a2z  8004 Oct 27 04:45 init-parse.php
-rwxr-x---  1 a2z a2z  6076 Oct 27 04:45 init.php
drwxr-xr-x 22 a2z a2z  4096 Oct 27 04:45 lib
-rwxr-xr--  1 a2z a2z 15236 Oct 27 04:45 LICENSE.txt
drwxr-xr-x  2 a2z a2z    64 Oct 27 04:45 maintenance
-rwxr-x---  1 a2z a2z  3896 Oct 27 04:45 memory.php
-rwxr-x---  1 a2z a2z  1775 Oct 27 04:45 phpadsnew.inc.php
drwxr-xr-x  2 a2z a2z    23 Oct 27 04:45 plugins
-rwxr-x---  1 a2z a2z 11081 Oct 27 04:45 pre-check.php
-rwxr-xr--  1 a2z a2z  2211 Oct 27 04:45 README.md
-rwxr-xr--  1 a2z a2z  6391 Oct 27 04:45 RELEASE_NOTES.txt
-rwxr-xr--  1 a2z a2z   384 Oct 27 04:45 robots.txt
drwxr-xr-x  3 a2z a2z    42 Oct 27 04:45 scripts
drwxrwxrwx  5 a2z a2z   153 Oct 27 05:18 var
-rwxr-x---  1 a2z a2z  6815 Oct 27 04:45 variables.php
drwxr-xr-x  6 a2z a2z   118 Oct 27 04:45 www
[a2z@edge adserver]$

That's a bit of a puzzler... it definitely appears that everything is readable and writable. And your PHP scripts are running in the correct mode.

I did some Googling and found similar questions in the revive-adserver Forums.

They unfortunately didn't all get resolutions to their issues, but some possible things did stick out.

One possibility was SELinux... is that running on your server there? As that could potentially cause some problems.

You can determine that with this command:

sestatus

bislinks's picture
Submitted by bislinks on Tue, 10/29/2019 - 11:07 Pro Licensee

[a2z@edge adserver]$ sestatus
SELinux status:                 disabled
[a2z@edge adserver]$

Okay, we can rule that out!

The only other idea I got from their Forums was that some said that one of the paths in the config pointed to a location that it couldn't write to. In their case it was the images path.

I unfortunately don't know what the name of the config file is, but do you see something that looks like a config file in the adserver installation? If so, do you see any paths, particularly the image path, that may point to a location that's not writable?

Feel free to post that config file here and we can take a look as well.

bislinks's picture
Submitted by bislinks on Fri, 11/01/2019 - 17:03 Pro Licensee

Is it this one?

<?php

/*
+---------------------------------------------------------------------------+
| Revive Adserver                                                           |
| http://www.revive-adserver.com                                            |
|                                                                           |
| Copyright: See the COPYRIGHT.txt file.                                    |
| License: GPLv2 or later, see the LICENSE.txt file.                        |
+---------------------------------------------------------------------------+
*/

/**
 * @package    Revive Adserver
 *
 * A pre-initialisation file to check if system settings allow Revive Adserver
 * to be run or not.
 */

require_once 'memory.php';

/**
 * A function to check system settings and display detected problems
 */
function RV_initialSystemCheck()
{
    $installed = OX_checkSystemInstalled();
    $aErrors = array();
    $erorCode = RV_checkSystemInitialRequirements($aErrors);
    if ($erorCode !== true) {
        $imageRelativePath = "./www/admin/precheck/";
        // Do functions strpos & parse_url exist? If so, try to
        // guess the proper relative path...
        if ($erorCode != -2) {
            // Checking if URL include www or admin in path
            if (strpos($_SERVER['REQUEST_URI'], '/www/admin/') !== false) {
                $imageRelativePath = "./precheck/";
            } else if (strpos($_SERVER['REQUEST_URI'], '/www/') !== false) {
                $imageRelativePath = "./admin/precheck/";
            }
        }
        // We always trying show images in CSS
        $bodyBackground = "url('{$imageRelativePath}body_piksel.gif') repeat-x";
        $liBackground = "background: url('{$imageRelativePath}list_element.gif') no-repeat;";
        $logo = "background: url('{$imageRelativePath}logo-adserver.png') no-repeat;";

        $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta name="Keywords" content="" />
    <meta name="Description" content="" />
    <title>php Error page</title>
    <style type="text/css">
        body {
            margin: 0;
            background: #fff '. $bodyBackground .';
            font-family: Arial, Helvetica, sans-serif;
            font: 12px Arial;
            color: #747474;
        }
        h1 {
            width:80%;
            font: 26px Arial;
            color:#000;
        }
        h2 {
            width:80%;
            font:12px Arial;
            color:#747474;
            margin-top:20px;
        }
        .error_container {
            margin-top: 80px;
            margin-left: 93px;
        }
        .error_list {
            width: 80%;
            padding-left: 33px;
            padding-top: 15px;
            padding-bottom:15px;
            line-height:18px;
            border-top: 1px solid #eee;
            border-bottom: 1px solid #eee;
        }
        ul {
            list-style-type: none;
            list-style-position: outside;
            padding:0px;
            padding-top:10px;
            margin:0px;
            margin-left:15px;

        }
        li {
            '.$liBackground.'
            padding-left:10px;
        }
        .help_link:active, .help_link:link, .help_link:visited  {
            color: #0767a8;
            text-decoration:none;
        }
        .help_link:hover {
            color: #0767a8;
            text-decoration:underline;
        }
        .logo_image {
            '.$logo.'
            width:  270px;
            height: 32px;
        }
    </style>
  </head>
  <body>
  <div class="logo_image">&nbsp;</div>
    <div class="error_container">';
        if ($installed) {
            $message .= "
      <h1>Sorry, but Revive Adserver cannot currently run on your machine</h1>";
        } else {
            $message .= "
      <h1>Sorry, but the Revive Adserver installer system cannot currently be started</h1>";
        }
        $message .= '
      <div class="error_list">
        Detected problem';
        if (count($aErrors) > 1) {
            $message .= "s";
        }
        $message .= ":
        <ul>";
        echo $message;
        foreach ($aErrors as $errorMessage) {
            echo "
          <li>{$errorMessage}</li>";
        }
        $message = "
        </ul>
      </div>
    </div>
  </body>
</html>";
        echo $message;
        // Terminate execution
        exit;
    }
}

/**
 * Check (roughly) to see if the system is installed without
 * any of the usual code to check this, as running in pre-init
 * mode.
 *
 * @return bool True if the system seems to be installed, false
 *              otherwise.
 */
function OX_checkSystemInstalled()
{
    $path = @dirname(__FILE__);
    if (!@empty($path)) {
        if (@file_exists($path . '/var/UPGRADE')) {
            return false;
        } else {
            return true;
        }
    }
    return false;
}

/**
 * Check for situation when installing or using software is eithe
 * imposible, or results in unformated error output, due to system
 * configuration.
 *
 * @param &$aErrors Array of error mesages. All errors that it is possible to
 *                  detect will be set, regardless of the function return value.
 * @return bool|int True on system check OK, negative int value on detected problems.
 *                         -1 => The "function_exists" built-in function doesn't exist
 *                         -2 => At least one of the "strpos" or "parse_url" built-in
 *                               functions don't exist
 *                         -3 => One of the other required built-in functions was
 *                               detected as being disabled
 *                         -4 => The amount of memory required was too low
 *
 */
function RV_checkSystemInitialRequirements(&$aErrors){

    // Variables for tracking if the test has passed or not,
    // and if not, what value to return
    $isSystemOK = true;
    $return = true;

    // The general list of built in PHP functions that are required to
    // run Revive Adserver, apart from the functions:
    //
    //   - "function_exists"
    //   - "array_intersect"
    //   - "explode"
    //   - "ini_get"
    //   - "trim"
    //   - "parse_url"
    //   - "strpos"
    //
    // These other functions are tested separately, as they are
    // required to test for the existence of the functions in the
    // array below!
    $aRequiredFunctions = array(
        'dirname',
        'empty',
        'file_exists',
        'ini_set',
        'parse_ini_file',
        'version_compare',
        'set_include_path',
        'scandir'
    );

    // Prepare error strings, in the simplest possible way
    $errorString1 = 'The built in PHP function "';
    $errorString2 = '" is in the "disable_functions" list in your "php.ini" file.';

    // Need "function_exists" to be able to test for functions required
    // for testing what is in the "disabled_functions" list
    if (!function_exists('function_exists')) {
        $aErrors[] = $errorString1 . 'function_exists' . $errorString2;
        // Cannot detect any more errors, as function_exists is
        // needed to detect the required functions!
        return -1;
    }

    // Test for existence of "parse_url" and "strpos", which are
    // special cases required for the display of the error message
    // in the event of anything failing in this test!
    if (!function_exists('parse_url')) {
        $aErrors[] = $errorString1 . 'parse_url' . $errorString2;
        $isSystemOK = false;
        if ($return === true) {
            $return = -2;
        }
    }
    if (!function_exists('strpos')) {
        $aErrors[] = $errorString1 . 'strpos' . $errorString2;
        $isSystemOK = false;
        if ($return === true) {
            $return = -2;
        }
    }

    // Test for existence of "array_intersect", "explode", "ini_get"
    // and "trim", which are all required as part of the code to test
    // which functions are in the "disabled_functions" list below...
    if (!function_exists('array_intersect')) {
        $aErrors[] = $errorString1 . 'array_intersect' . $errorString2;
        $isSystemOK = false;
        if ($return === true) {
            $return = -3;
        }
    }
    if (!function_exists('explode')) {
        $aErrors[] = $errorString1 . 'explode' . $errorString2;
        $isSystemOK = false;
        if ($return === true) {
            $return = -3;
        }
    }
    if (!function_exists('ini_get')) {
        $aErrors[] = $errorString1 . 'ini_get' . $errorString2;
        $isSystemOK = false;
        if ($return === true) {
            $return = -3;
        }
    }
    if (!function_exists('trim')) {
        $aErrors[] = $errorString1 . 'trim' . $errorString2;
        $isSystemOK = false;
        if ($return === true) {
            $return = -3;
        }
    }

    // Test the disabled functons list with required functions list
    // defined above in $aRequiredFunctions
    $aDisabledFunctions = explode(',', ini_get('disable_functions'));
    foreach ($aDisabledFunctions as $key => $value) {
        $aDisabledFunctions[$key] = trim($value);
    }
    $aNeededFunctions = array_intersect($aDisabledFunctions, $aRequiredFunctions);
    if (count($aNeededFunctions) > 0) {
        $isSystemOK = false;
        if ($return === true) {
            $return = -3;
        }
        foreach ($aNeededFunctions as $functionName) {
            $aErrors[] = $errorString1 . $functionName . $errorString2;
        }
    }

    // Check PHP version, as use of anything below the minimum required version of PHP
    // may result in parse errors, which we want to avoid
    if (PHP_VERSION_ID < 70008) {
        $aErrors[] = "PHP version 7.0.8, or greater, was not detected.";
        $isSystemOK = false;
        if ($return === true) {
            $return = -3;
        }
    }

    // Check minimum memory requirements are okay (24MB)
    $minimumRequiredMemory = OX_getMinimumRequiredMemory();
    $phpMemoryLimit = OX_getMemoryLimitSizeInBytes();
    if ($phpMemoryLimit > 0 && $phpMemoryLimit < $minimumRequiredMemory) {
        // The memory limit is too low, but can it be increased?
        $memoryCanBeSet = OX_checkMemoryCanBeSet();
        if (!$memoryCanBeSet) {
            $minimumRequiredMemoryInMB = $minimumRequiredMemory / 1048576;
            $aErrors[] = 'The PHP "memory_limit" value is set to less than the required minimum of ' .
                         $minimumRequiredMemoryInMB . 'MB, but because the built in PHP function "ini_set" ' .
                         'has been disabled, the memory limit cannot be automatically increased.';
            $isSystemOK = false;
            if ($return === true) {
                $return = -4;
            }
        }
    }

    if (!$isSystemOK) {
        return $return;
    }
    return true;
}

RV_initialSystemCheck();

?>

Hmm, that looks more like a file containing PHP code than a config file.

I see in "/home/a2z/public_html/adserver/var", that there's something named "a2z.blue.conf.php", are you able to edit that? I suspect that would be the config file.

bislinks's picture
Submitted by bislinks on Sat, 11/02/2019 - 11:08 Pro Licensee

Unable to edit that file using nano.

[a2z@edge adserver]$ file var/a2z.blue.conf.php
var/a2z.blue.conf.php: broken symbolic link to `/home/a2z/public_html/adserver/var/www.a2z.blue.conf.php'

[a2z@edge adserver]$ stat var/a2z.blue.conf.php
  File: ‘var/a2z.blue.conf.php’ -> ‘/home/a2z/public_html/adserver/var/www.a2z.blue.conf.php’
  Size: 56        Blocks: 0          IO Block: 4096   symbolic link
Device: fc01h/64513d Inode: 13375078    Links: 1
Access: (0777/lrwxrwxrwx)  Uid: ( 1007/     a2z)   Gid: ( 1007/     a2z)
Access: 2019-11-01 19:57:29.714448891 +0000
Modify: 2019-10-27 04:45:18.424110180 +0000
Change: 2019-10-27 04:45:18.424110180 +0000
Birth: -
[a2z@edge adserver]$