Try CumulusClips Cloud Hosting

Unable to locate path to PHP-CLI (not solved)

Hello all,
i'm a new french CumulusClips user, and sorry for my probably bad english.

I have successfully installed this script, and i can access to the webpage.
So, i'm unable to upload any video because "Unable to locate path to PHP-CLI" in Settings > Videos.

I use apache2 on Debian Jessie with VestaCP web hosting control panel.
I've tried which php and the result is /usr/bin/php
I try to put this result in the Settings > video textbox, and "Unable to locate...".

I've tried whereis php and the result is php: /usr/bin/php /usr/share/php /usr/share/man/man1/php.1.gz. I try to put /usr/bin/php and /urs/share/php (with and without / at the end), and doesn't work.

If you have any suggest, i'm interested.
Thanks !

Comments

  • Let's try two things. First run this command and post here the output:

    /usr/bin/php --version
    Next create a file named debug.php where index.php, with this content:

    <?php

    $phpPath = '/usr/bin/php';

    if (!file_exists($phpPath)) {
    echo "File doesn't exist" . PHP_EOL;
    exit();
    }

    if (!is_executable($phpPath)) {
    echo "File isn't executable" . PHP_EOL;
    exit();
    }

    $phpCliResults = @exec($phpPath . ' -r "' . "echo 'cliBinary';" . '" 2>&1 | grep cliBinary');
    if (empty($phpCliResults)) {
    echo "Invalid CLI binary" . PHP_EOL;
    exit();
    }

    echo "File is good!" . PHP_EOL;

    Save it and access it from your browser, i.e. http://yoursite.com/debug.php. Also post here the output.
  • edited March 9
    Hello,
    at first, thanks for your reply.

    The first command return PHP 5.6.30-0+deb8u1 (cli) (built: Feb 8 2017 08:50:21)
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies


    The depub.php page show "File doesn't exist"
    http://vid.abhd.fr/debug.php

    In the Web panel official documentation website, we have a list of paths :
    http://vestacp.com/docs/#config-log-location-debian-ubuntu

    Thanks again
  • edited March 9
    It seems like Apache is unable to interfact with the PHP CLI binary. Open the debug file and append "clearstatcache();" so that it looks like this:

    <?php

    clearstatcache();

    Then save and open the page again from your browser and post the results here.
  • edited March 9
    My debug.php
    <?php

    clearstatcache();

    $phpPath = '/usr/bin/php';

    if (!file_exists($phpPath)) {
    echo "File doesn't exist" . PHP_EOL;
    exit();
    }

    if (!is_executable($phpPath)) {
    echo "File isn't executable" . PHP_EOL;
    exit();
    }

    $phpCliResults = @exec($phpPath . ' -r "' . "echo 'cliBinary';" . '" 2>&1 | grep cliBinary');
    if (empty($phpCliResults)) {
    echo "Invalid CLI binary" . PHP_EOL;
    exit();
    }

    echo "File is good!" . PHP_EOL;


    and same result : "File doesn't exist"

    I already have tested just with <?php

    clearstatcache();
    and he show a blank page
  • Yeah, definitely looks like Apache, or the user that is running PHP doesn't have permissions to interact with the PHP binary. Try running this from the command line and report back the results:

    ls -l /usr/bin/php

    In the debug file add this and run it from the browser:

    <?php

    $processUser = posix_getpwuid(posix_geteuid());
    var_dump($processUser);

    Then post the results.
  • The first command result
    lrwxrwxrwx 1 root root 21 Mar 9 05:09 /usr/bin/php -> /etc/alternatives/php

    And my debug file is now
    <?php

    $processUser = posix_getpwuid(posix_geteuid());
    var_dump($processUser);

    clearstatcache();

    $phpPath = '/usr/bin/php';

    if (!file_exists($phpPath)) {
    echo "File doesn't exist" . PHP_EOL;
    exit();
    }

    if (!is_executable($phpPath)) {
    echo "File isn't executable" . PHP_EOL;
    exit();
    }


    And the webpage show
    array(7) { ["name"]=> string(5) "admin" ["passwd"]=> string(1) "x" ["uid"]=> int(1000) ["gid"]=> int(1000) ["gecos"]=> string(14) "adrien@abhd.fr" ["dir"]=> string(11) "/home/admin" ["shell"]=> string(9) "/bin/bash" } File doesn't exist

    Webpage access : vid.abhd.fr/debug.php
  • Ok, so we found out the your php binary path is not the actual binary but a symlink to "/etc/alternatives/php". Can you run:

    ls -l /etc/alternatives/php
    and post here the results.
  • edited March 10
    Sorry for the response time, i launch this command and the result
    lrwxrwxrwx 1 root root 13 Mar 9 05:09 /etc/alternatives/php -> /usr/bin/php5
    i've tried with /usr/bin/php5 in php path on CumulusClips, but sill not work.
  • Boy this is turning into a rabbit hole. Run the ls command from above this time using the /usr/bin/php5 path.
  • edited March 11
    The command ls -l /usr/bin/php5 return
    -rwxr-xr-x 1 root root 9085672 Feb 8 10:07 /usr/bin/php5

    If i understoud ?
    /usr/bin/php -> /etc/alternatives/php -> /usr/bin/php5
    It's a realy strange configuration !

    I'm so sorry, i use a web hosting control panel for my server, because i host more friends's websites, and it's easy for use for us. Thanks again for your help.
  • I'm researching what could be the cause for this issue.

    In the meantime, now that we know the exact path of the binary run the debug script from your browser with this content, and post the results.

    <?php

    clearstatcache();

    $phpPath = '/usr/bin/php5';
    $failed = false;

    if (!file_exists($phpPath)) {
    echo "File doesn't exist<br>";
    $failed = true;
    }

    if (!is_executable($phpPath)) {
    echo "File isn't executable<br>";
    $failed = true;
    }

    $phpCliResults = @exec($phpPath . ' -r "' . "echo 'cliBinary';" . '" 2>&1 | grep cliBinary');
    if (empty($phpCliResults)) {
    echo "Invalid CLI binary<br>";
    $failed = true;
    }

    if (!$failed) echo "File is good!";

    As I said, I'm still looking into this, I just want to see the output of the updated debugger.
  • The browser just showing this message
    File doesn't exist
    File isn't executable
  • Ok, I think I figured out a workaround for you. Open the file /cc-admin/settings_video.php and comment out line 136. It should look like this after you comment it out:

    //if (!is_executable($phpExe)) continue;
    Save the file and add /usr/bin/php5 in the Admin Panel -> Settings -> Video -> PHP Path field. See if it'll accept your values.
  • The value is not accepted by the admin panel :/
  • edited March 12
    That doesn't make sense. It passed the check in the debug script, but failed the exact same check in the admin panel. Did you comment out the line like I asked in my last post?
  • That is the CLI part of settings_video.php in cc-admin
    // Validate php-cli path
    if (empty ($_POST['php'])) {
    @exec('whereis php', $whereis_results);
    $phpPaths = explode (' ', preg_replace ('/^php:\s?/','', $whereis_results[0]));
    } else if (!empty ($_POST['php']) && file_exists ($_POST['php'])) {
    $phpPaths = array(rtrim ($_POST['php'], '/'));
    } else {
    $phpPaths = array();
    }

    $phpBinary = false;
    foreach ($phpPaths as $phpExe) {
    // if (!is_executable($phpExe)) continue;
    @exec($phpExe . ' -r "' . "echo 'cliBinary';" . '" 2>&1 | grep cliBinary', $phpCliResults);
    $phpCliResults = implode(' ', $phpCliResults);
    if (!empty($phpCliResults)) {
    $phpCliBinary = $phpExe;
    break;
    }
    }

    if ($phpCliBinary) {
    $data['php'] = $phpCliBinary;
    } else {
    $warnings['php'] = 'Unable to locate path to PHP-CLI';
    $data['php'] = '';
    }


    and the message is Settings have been updated, but there are notices.
    Notice:

    The following requirements were not met. As a result video uploads have been disabled.

    - Unable to locate path to PHP-CLI
    If you're using a plugin or service for encoding videos you can ignore this message.
  • Hmm, I'm curious to see what the error being thrown is. Find this line:

    $phpCliResults = implode(' ', $phpCliResults);
    in that file, and add this right after it:

    var_dump($phpCliResults);
    Then try again with the /usr/bin/php5. It will output to the top of the screen. Post here the output.
  • The new php-CLI part of settings-video.php in cc-admin
    // Validate php-cli path
    if (empty ($_POST['php'])) {
    @exec('whereis php', $whereis_results);
    $phpPaths = explode (' ', preg_replace ('/^php:\s?/','', $whereis_results[0]));
    } else if (!empty ($_POST['php']) && file_exists ($_POST['php'])) {
    $phpPaths = array(rtrim ($_POST['php'], '/'));
    } else {
    $phpPaths = array();
    }

    $phpBinary = false;
    foreach ($phpPaths as $phpExe) {
    // if (!is_executable($phpExe)) continue;
    @exec($phpExe . ' -r "' . "echo 'cliBinary';" . '" 2>&1 | grep cliBinary', $phpCliResults);
    $phpCliResults = implode(' ', $phpCliResults);
    var_dump($phpCliResults);
    if (!empty($phpCliResults)) {
    $phpCliBinary = $phpExe;
    break;
    }
    }

    if ($phpCliBinary) {
    $data['php'] = $phpCliBinary;
    } else {
    $warnings['php'] = 'Unable to locate path to PHP-CLI';
    $data['php'] = '';
    }



    The output is same : Settings have been updated, but there are notices.
    Notice:

    The following requirements were not met. As a result video uploads have been disabled.

    - Unable to locate path to PHP-CLI
    If you're using a plugin or service for encoding videos you can ignore this message.
  • Oops, sorry forgot one thing. Remove the " | grep cliBinary". Then try again. It will print out some debug stuff to the screen this time.
  • edited March 13
    I have an internal server error, that is the new php-CLI part
    // Validate php-cli path
    if (empty ($_POST['php'])) {
    @exec('whereis php', $whereis_results);
    $phpPaths = explode (' ', preg_replace ('/^php:\s?/','', $whereis_results[0]));
    } else if (!empty ($_POST['php']) && file_exists ($_POST['php'])) {
    $phpPaths = array(rtrim ($_POST['php'], '/'));
    } else {
    $phpPaths = array();
    }

    $phpBinary = false;
    foreach ($phpPaths as $phpExe) {
    // if (!is_executable($phpExe)) continue;
    @exec($phpExe . ' -r "' . "echo 'cliBinary';" . '" 2>&1, $phpCliResults);
    $phpCliResults = implode(' ', $phpCliResults);
    var_dump($phpCliResults);
    if (!empty($phpCliResults)) {
    $phpCliBinary = $phpExe;
    break;
    }
    }

    if ($phpCliBinary) {
    $data['php'] = $phpCliBinary;
    } else {
    $warnings['php'] = 'Unable to locate path to PHP-CLI';
    $data['php'] = '';
    }

    i've tried with 2>&1, and 2>&1 and the error 500 persist.
  • You're missing the closing ' after the 2>&1. It should look like this:

    @exec($phpExe . ' -r "' . "echo 'cliBinary';" . '" 2>&1', $phpCliResults);
  • After modification, i have the same error message :
    Settings have been updated, but there are notices.
    Notice:

    The following requirements were not met. As a result video uploads have been disabled.

    - Unable to locate path to PHP-CLI
    If you're using a plugin or service for encoding videos you can ignore this message.

    and no more
  • Remove the '@' symbol from before "exec" call. Maybe there's an error that's being suppressed.
  • @ deleted, ans same error message, no more. I think i will search an another alternative, because it's still doesn't work after your help. Realy thank you (:
  • Did you install PHP CLI?

    apt-get install php5-cli
  • Of course, PHP CLI is already installed, it's my first ckeck before post here.
Sign In or Register to comment.