I can't run php on CLI

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
1
down vote

favorite












When I install it again it says php is already the newest version.
when I run php -v the out put is this:



The program 'php' can be found in the following packages:
* php7.0-cli
* hhvm
Try: sudo apt install <selected package>


when runing type php:



bash: type: php: not found


When I run whereis php the out put is this:



$ whereis php
php: /usr/bin/php.old /usr/bin/php7.0 /usr/lib/php /etc/php /usr/share/php7.0-common /usr/share/php7.0-intl /usr/share/php7.0-json /usr/share/php /usr/share/php7.0-zip /usr/share/php7.0-mcrypt /usr/share/php7.0-mysql /usr/share/php7.0-readline /usr/share/php7.0-opcache /usr/share/php7.0-xml /usr/share/php7.0-mbstring /usr/share/php7.0-gd /usr/share/man/man1/php.1.gz


I have looked for solutions but none of them worked.







share|improve this question


















  • 1




    /usr/bin/php7.0 ???
    – cmak.fr
    May 24 at 17:18






  • 1




    Please post the output from when you try to run php, including the exact command you use. Also post the output of type php; this is more useful than whereis php or which php. You can edit your question to add info. By the way, welcome to Ask Ubuntu!
    – wjandrea
    May 24 at 17:26











  • @wjandrea just did. please i need a solution asap.
    – Robgogo
    May 24 at 17:53














up vote
1
down vote

favorite












When I install it again it says php is already the newest version.
when I run php -v the out put is this:



The program 'php' can be found in the following packages:
* php7.0-cli
* hhvm
Try: sudo apt install <selected package>


when runing type php:



bash: type: php: not found


When I run whereis php the out put is this:



$ whereis php
php: /usr/bin/php.old /usr/bin/php7.0 /usr/lib/php /etc/php /usr/share/php7.0-common /usr/share/php7.0-intl /usr/share/php7.0-json /usr/share/php /usr/share/php7.0-zip /usr/share/php7.0-mcrypt /usr/share/php7.0-mysql /usr/share/php7.0-readline /usr/share/php7.0-opcache /usr/share/php7.0-xml /usr/share/php7.0-mbstring /usr/share/php7.0-gd /usr/share/man/man1/php.1.gz


I have looked for solutions but none of them worked.







share|improve this question


















  • 1




    /usr/bin/php7.0 ???
    – cmak.fr
    May 24 at 17:18






  • 1




    Please post the output from when you try to run php, including the exact command you use. Also post the output of type php; this is more useful than whereis php or which php. You can edit your question to add info. By the way, welcome to Ask Ubuntu!
    – wjandrea
    May 24 at 17:26











  • @wjandrea just did. please i need a solution asap.
    – Robgogo
    May 24 at 17:53












up vote
1
down vote

favorite









up vote
1
down vote

favorite











When I install it again it says php is already the newest version.
when I run php -v the out put is this:



The program 'php' can be found in the following packages:
* php7.0-cli
* hhvm
Try: sudo apt install <selected package>


when runing type php:



bash: type: php: not found


When I run whereis php the out put is this:



$ whereis php
php: /usr/bin/php.old /usr/bin/php7.0 /usr/lib/php /etc/php /usr/share/php7.0-common /usr/share/php7.0-intl /usr/share/php7.0-json /usr/share/php /usr/share/php7.0-zip /usr/share/php7.0-mcrypt /usr/share/php7.0-mysql /usr/share/php7.0-readline /usr/share/php7.0-opcache /usr/share/php7.0-xml /usr/share/php7.0-mbstring /usr/share/php7.0-gd /usr/share/man/man1/php.1.gz


I have looked for solutions but none of them worked.







share|improve this question














When I install it again it says php is already the newest version.
when I run php -v the out put is this:



The program 'php' can be found in the following packages:
* php7.0-cli
* hhvm
Try: sudo apt install <selected package>


when runing type php:



bash: type: php: not found


When I run whereis php the out put is this:



$ whereis php
php: /usr/bin/php.old /usr/bin/php7.0 /usr/lib/php /etc/php /usr/share/php7.0-common /usr/share/php7.0-intl /usr/share/php7.0-json /usr/share/php /usr/share/php7.0-zip /usr/share/php7.0-mcrypt /usr/share/php7.0-mysql /usr/share/php7.0-readline /usr/share/php7.0-opcache /usr/share/php7.0-xml /usr/share/php7.0-mbstring /usr/share/php7.0-gd /usr/share/man/man1/php.1.gz


I have looked for solutions but none of them worked.









share|improve this question













share|improve this question




share|improve this question








edited May 24 at 17:52

























asked May 24 at 17:09









Robgogo

62




62







  • 1




    /usr/bin/php7.0 ???
    – cmak.fr
    May 24 at 17:18






  • 1




    Please post the output from when you try to run php, including the exact command you use. Also post the output of type php; this is more useful than whereis php or which php. You can edit your question to add info. By the way, welcome to Ask Ubuntu!
    – wjandrea
    May 24 at 17:26











  • @wjandrea just did. please i need a solution asap.
    – Robgogo
    May 24 at 17:53












  • 1




    /usr/bin/php7.0 ???
    – cmak.fr
    May 24 at 17:18






  • 1




    Please post the output from when you try to run php, including the exact command you use. Also post the output of type php; this is more useful than whereis php or which php. You can edit your question to add info. By the way, welcome to Ask Ubuntu!
    – wjandrea
    May 24 at 17:26











  • @wjandrea just did. please i need a solution asap.
    – Robgogo
    May 24 at 17:53







1




1




/usr/bin/php7.0 ???
– cmak.fr
May 24 at 17:18




/usr/bin/php7.0 ???
– cmak.fr
May 24 at 17:18




1




1




Please post the output from when you try to run php, including the exact command you use. Also post the output of type php; this is more useful than whereis php or which php. You can edit your question to add info. By the way, welcome to Ask Ubuntu!
– wjandrea
May 24 at 17:26





Please post the output from when you try to run php, including the exact command you use. Also post the output of type php; this is more useful than whereis php or which php. You can edit your question to add info. By the way, welcome to Ask Ubuntu!
– wjandrea
May 24 at 17:26













@wjandrea just did. please i need a solution asap.
– Robgogo
May 24 at 17:53




@wjandrea just did. please i need a solution asap.
– Robgogo
May 24 at 17:53










2 Answers
2






active

oldest

votes

















up vote
1
down vote













I've never used PHP, so take this with a grain of salt:



It looks like /usr/bin/php got renamed to php.old. I'm guessing if you run readlink /usr/bin/php.old it will point to /usr/bin/php7.0. If so, you can un-rename it by running



sudo mv /usr/bin/php.old /usr/bin/php


Otherwise, you could create a new /usr/bin/php:



sudo ln -s php7.0 /usr/bin/php


Or reinstall the whole package:



sudo apt-get install --reinstall php7.0-cli





share|improve this answer



























    up vote
    1
    down vote













    Looks like you have php7.0-cli installed, but no /usr/bin/php. The latter is normally a symlink managed by the alternatives system. You can show the status of that by issuing the following command:



    $ update-alternatives --display php
    php - automatischer Modus
    beste Version des Links ist /usr/bin/php7.0
    Link verweist zur Zeit auf /usr/bin/php7.0
    Link php ist /usr/bin/php
    Slave php.1.gz ist /usr/share/man/man1/php.1.gz
    /usr/bin/php7.0 - Priorität 70
    Slave php.1.gz: /usr/share/man/man1/php7.0.1.gz


    If this shows different output on your computer this is probably not set correctly. You can try to run update-alternatives --auto php and test again if a) php -v works now and b) update-alternatives --display php now produces output similar to the above.



    If this didn't help you can manually set the alternative: update-alternatives --set php /usr/bin/php7.0 and test again.






    share|improve this answer




















      Your Answer







      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "89"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );








       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1039914%2fi-cant-run-php-on-cli%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      1
      down vote













      I've never used PHP, so take this with a grain of salt:



      It looks like /usr/bin/php got renamed to php.old. I'm guessing if you run readlink /usr/bin/php.old it will point to /usr/bin/php7.0. If so, you can un-rename it by running



      sudo mv /usr/bin/php.old /usr/bin/php


      Otherwise, you could create a new /usr/bin/php:



      sudo ln -s php7.0 /usr/bin/php


      Or reinstall the whole package:



      sudo apt-get install --reinstall php7.0-cli





      share|improve this answer
























        up vote
        1
        down vote













        I've never used PHP, so take this with a grain of salt:



        It looks like /usr/bin/php got renamed to php.old. I'm guessing if you run readlink /usr/bin/php.old it will point to /usr/bin/php7.0. If so, you can un-rename it by running



        sudo mv /usr/bin/php.old /usr/bin/php


        Otherwise, you could create a new /usr/bin/php:



        sudo ln -s php7.0 /usr/bin/php


        Or reinstall the whole package:



        sudo apt-get install --reinstall php7.0-cli





        share|improve this answer






















          up vote
          1
          down vote










          up vote
          1
          down vote









          I've never used PHP, so take this with a grain of salt:



          It looks like /usr/bin/php got renamed to php.old. I'm guessing if you run readlink /usr/bin/php.old it will point to /usr/bin/php7.0. If so, you can un-rename it by running



          sudo mv /usr/bin/php.old /usr/bin/php


          Otherwise, you could create a new /usr/bin/php:



          sudo ln -s php7.0 /usr/bin/php


          Or reinstall the whole package:



          sudo apt-get install --reinstall php7.0-cli





          share|improve this answer












          I've never used PHP, so take this with a grain of salt:



          It looks like /usr/bin/php got renamed to php.old. I'm guessing if you run readlink /usr/bin/php.old it will point to /usr/bin/php7.0. If so, you can un-rename it by running



          sudo mv /usr/bin/php.old /usr/bin/php


          Otherwise, you could create a new /usr/bin/php:



          sudo ln -s php7.0 /usr/bin/php


          Or reinstall the whole package:



          sudo apt-get install --reinstall php7.0-cli






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered May 24 at 19:12









          wjandrea

          7,02542054




          7,02542054






















              up vote
              1
              down vote













              Looks like you have php7.0-cli installed, but no /usr/bin/php. The latter is normally a symlink managed by the alternatives system. You can show the status of that by issuing the following command:



              $ update-alternatives --display php
              php - automatischer Modus
              beste Version des Links ist /usr/bin/php7.0
              Link verweist zur Zeit auf /usr/bin/php7.0
              Link php ist /usr/bin/php
              Slave php.1.gz ist /usr/share/man/man1/php.1.gz
              /usr/bin/php7.0 - Priorität 70
              Slave php.1.gz: /usr/share/man/man1/php7.0.1.gz


              If this shows different output on your computer this is probably not set correctly. You can try to run update-alternatives --auto php and test again if a) php -v works now and b) update-alternatives --display php now produces output similar to the above.



              If this didn't help you can manually set the alternative: update-alternatives --set php /usr/bin/php7.0 and test again.






              share|improve this answer
























                up vote
                1
                down vote













                Looks like you have php7.0-cli installed, but no /usr/bin/php. The latter is normally a symlink managed by the alternatives system. You can show the status of that by issuing the following command:



                $ update-alternatives --display php
                php - automatischer Modus
                beste Version des Links ist /usr/bin/php7.0
                Link verweist zur Zeit auf /usr/bin/php7.0
                Link php ist /usr/bin/php
                Slave php.1.gz ist /usr/share/man/man1/php.1.gz
                /usr/bin/php7.0 - Priorität 70
                Slave php.1.gz: /usr/share/man/man1/php7.0.1.gz


                If this shows different output on your computer this is probably not set correctly. You can try to run update-alternatives --auto php and test again if a) php -v works now and b) update-alternatives --display php now produces output similar to the above.



                If this didn't help you can manually set the alternative: update-alternatives --set php /usr/bin/php7.0 and test again.






                share|improve this answer






















                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  Looks like you have php7.0-cli installed, but no /usr/bin/php. The latter is normally a symlink managed by the alternatives system. You can show the status of that by issuing the following command:



                  $ update-alternatives --display php
                  php - automatischer Modus
                  beste Version des Links ist /usr/bin/php7.0
                  Link verweist zur Zeit auf /usr/bin/php7.0
                  Link php ist /usr/bin/php
                  Slave php.1.gz ist /usr/share/man/man1/php.1.gz
                  /usr/bin/php7.0 - Priorität 70
                  Slave php.1.gz: /usr/share/man/man1/php7.0.1.gz


                  If this shows different output on your computer this is probably not set correctly. You can try to run update-alternatives --auto php and test again if a) php -v works now and b) update-alternatives --display php now produces output similar to the above.



                  If this didn't help you can manually set the alternative: update-alternatives --set php /usr/bin/php7.0 and test again.






                  share|improve this answer












                  Looks like you have php7.0-cli installed, but no /usr/bin/php. The latter is normally a symlink managed by the alternatives system. You can show the status of that by issuing the following command:



                  $ update-alternatives --display php
                  php - automatischer Modus
                  beste Version des Links ist /usr/bin/php7.0
                  Link verweist zur Zeit auf /usr/bin/php7.0
                  Link php ist /usr/bin/php
                  Slave php.1.gz ist /usr/share/man/man1/php.1.gz
                  /usr/bin/php7.0 - Priorität 70
                  Slave php.1.gz: /usr/share/man/man1/php7.0.1.gz


                  If this shows different output on your computer this is probably not set correctly. You can try to run update-alternatives --auto php and test again if a) php -v works now and b) update-alternatives --display php now produces output similar to the above.



                  If this didn't help you can manually set the alternative: update-alternatives --set php /usr/bin/php7.0 and test again.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 24 at 19:36









                  Lienhart Woitok

                  808211




                  808211






















                       

                      draft saved


                      draft discarded


























                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1039914%2fi-cant-run-php-on-cli%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      pylint3 and pip3 broken

                      Missing snmpget and snmpwalk

                      How to enroll fingerprints to Ubuntu 17.10 with VFS491