Magento 2 Install

Discussion in 'Linux Support: RHEL, CentOS, SUSE etc' started by TexasGreg, Feb 11, 2018.

  1. TexasGreg

    TexasGreg New Member

    I'm installing Magento 2.2.2 on Centos 7 using Litespeed PHP 7.1.14 and after the install, it appeared no CSS was applied. I found this solution to that problem:

    php bin/magento setup:static-content:deploy
    php bin/magento indexer:reindex
    rm -rf var/cache/*
    chown -R nobody:nobody

    but when I run "php bin/magento setup:static-content:deploy" I get this error:

    #!/usr/bin/env php
    bin/magento must be run as a CLI application

    On the server, other non-Magento php scripts launch without any problems from the command line.

    I solved this by removing:

    if (PHP_SAPI !== 'cli') {
    echo 'bin/magento must be run as a CLI application';

    from /bin/magento
    Last edited: Feb 12, 2018
  2. lskagan

    lskagan Administrator

    Please try running php directly ie
    /usr/local/lsws/lsphp71/bin/php bin/magento setup:static-content:deploy
  3. TexasGreg

    TexasGreg New Member

    I did with the same result. I have a symbolic link set up from /usr/bin/php to /usr/local/lsws/lsphp71/bin/php
  4. TexasGreg

    TexasGreg New Member

    Checked again and you are right "/usr/local/lsws/lsphp71/bin/php" worked. Why would the symbolic link not work the same?
  5. TexasGreg

    TexasGreg New Member

    I figured this out. This fixed it.

    rm /usr/bin/php
    ln -s /usr/local/lsws/lsphp71/bin/php /usr/bin/php

Share This Page