Join the community today
Become a Member

PHP-FPM PHP command line version is different from phpinfo() ??

Discussion in 'Nginx, PHP-FPM & MariaDB MySQL' started by nVidian, Mar 17, 2015.

Tags:
  1. nVidian

    nVidian Member

    98
    8
    8
    Mar 16, 2015
    Ratings:
    +31
    Local Time:
    7:25 PM
    1.7.9
    5.5
    Hi Mask, this is the result
    Code:
    # rpm -qa | grep php
    php-cli-5.3.3-40.el6_6.x86_64
    php-common-5.3.3-40.el6_6.x86_64
    php-pear-1.9.4-4.el6.noarch
    
    FYI, my VPS is Linode. Do you has experience with their Centos 6.5 template ?

     
  2. eva2000

    eva2000 Administrator Staff Member

    54,548
    12,221
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,790
    Local Time:
    10:25 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    ah ha there's your problem

    php-cli-5.3.3-40.el6_6

    yum php cli package installed !!
    Code:
    yum -y remove php-*
    
    should fix it !

    so @Mask was correct !
     
  3. nVidian

    nVidian Member

    98
    8
    8
    Mar 16, 2015
    Ratings:
    +31
    Local Time:
    7:25 PM
    1.7.9
    5.5
    I run it
    Code:
    # yum -y remove php-*
    Loaded plugins: downloadonly, fastestmirror, priorities
    Setting up Remove Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package php-cli.x86_64 0:5.3.3-40.el6_6 will be erased
    ---> Package php-common.x86_64 0:5.3.3-40.el6_6 will be erased
    ---> Package php-pear.noarch 1:1.9.4-4.el6 will be erased
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ================================================================================
    Package  Arch  Version  Repository  Size
    ================================================================================
    Removing:
    php-cli  x86_64  5.3.3-40.el6_6  @updates  6.2 M
    php-common  x86_64  5.3.3-40.el6_6  @updates  2.9 M
    php-pear  noarch  1:1.9.4-4.el6  @base  2.2 M
    
    Transaction Summary
    ================================================================================
    Remove  3 Package(s)
    
    Installed size: 11 M
    Downloading Packages:
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Erasing  : 1:php-pear-1.9.4-4.el6.noarch  1/3
      Erasing  : php-cli-5.3.3-40.el6_6.x86_64  2/3
      Erasing  : php-common-5.3.3-40.el6_6.x86_64  3/3
      Verifying  : 1:php-pear-1.9.4-4.el6.noarch  1/3
      Verifying  : php-cli-5.3.3-40.el6_6.x86_64  2/3
      Verifying  : php-common-5.3.3-40.el6_6.x86_64  3/3
    
    Removed:
      php-cli.x86_64 0:5.3.3-40.el6_6  php-common.x86_64 0:5.3.3-40.el6_6
      php-pear.noarch 1:1.9.4-4.el6
    
    Complete!
    
    Test php -v again
    Code:
    # php -v
    bash: /usr/bin/php: No such file or directory
    

    Should I recompile with Menu #5 again ?
     
    Last edited: Mar 18, 2015
  4. Mask

    Mask Active Member

    108
    31
    28
    Nov 10, 2014
    Ratings:
    +37
    Local Time:
    5:25 PM
    Nginx 1.9.1
    MariaDB 10.0.19
    Yup, do that again so php get's installed properly :)
     
  5. nVidian

    nVidian Member

    98
    8
    8
    Mar 16, 2015
    Ratings:
    +31
    Local Time:
    7:25 PM
    1.7.9
    5.5
    After recompile I run php-v again
    Code:
    # php -v
    bash: /usr/bin/php: No such file or directory
    
    wrong directory ?
     
  6. eva2000

    eva2000 Administrator Staff Member

    54,548
    12,221
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,790
    Local Time:
    10:25 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    try logging out of SSH session and back in
     
  7. nVidian

    nVidian Member

    98
    8
    8
    Mar 16, 2015
    Ratings:
    +31
    Local Time:
    7:25 PM
    1.7.9
    5.5
    Code:
    # php -v
    PHP 5.3.3 (cli) (built: Oct 30 2014 20:12:53)
    Copyright (c) 1997-2010 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    
    This is the log: upgrade_php-3.txt - Google Drive

    If I just let it be, what is the possible effect ? Will it create problem in the future ?

    Thank you for your help.
     
  8. eva2000

    eva2000 Administrator Staff Member

    54,548
    12,221
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,790
    Local Time:
    10:25 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yeah will be problematic if let as is

    everything in that log says PHP upgraded and recompiled successfully

    what's current output for these commands

    Code:
    which php
    ls -lah /usr/local/bin/php
    /usr/local/bin/php -v
    rpm -qa | grep php
    
     
  9. nVidian

    nVidian Member

    98
    8
    8
    Mar 16, 2015
    Ratings:
    +31
    Local Time:
    7:25 PM
    1.7.9
    5.5
    I just accidentally forgot to switch to root and this is php -v from non root (just after login via SSH)
    Code:
    $ php -v
    PHP 5.5.22 (cli) (built: Mar 18 2015 15:48:13)
    Copyright (c) 1997-2015 The PHP Group
    Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
      with Zend OPcache v7.0.4, Copyright (c) 1999-2014, by Zend Technologies
    
    And then I switch to root with sudo su (no password):
    Code:
    $ sudo su
    # php -v
    PHP 5.3.3 (cli) (built: Oct 30 2014 20:12:53)
    Copyright (c) 1997-2010 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    
    For further testing I switch again to non root user, but this time PHP version stay at 5.3.3
    Code:
    $ php -v
    PHP 5.3.3 (cli) (built: Oct 30 2014 20:12:53)
    Copyright (c) 1997-2010 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    


    Code:
    # which php
    /usr/bin/php
    
    Code:
    # ls -lah /usr/local/bin/php
    -rwxr-xr-x 1 root root 35M Mar 18 15:49 /usr/local/bin/php
    
    Code:
    # /usr/local/bin/php -v
    PHP 5.5.22 (cli) (built: Mar 18 2015 15:48:13)
    Copyright (c) 1997-2015 The PHP Group
    Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
      with Zend OPcache v7.0.4, Copyright (c) 1999-2014, by Zend Technologies
    
    Code:
    # rpm -qa | grep php
    php-pear-1.9.4-4.el6.noarch
    php-cli-5.3.3-40.el6_6.x86_64
    php-common-5.3.3-40.el6_6.x86_64
    
     
    Last edited: Mar 18, 2015
  10. nVidian

    nVidian Member

    98
    8
    8
    Mar 16, 2015
    Ratings:
    +31
    Local Time:
    7:25 PM
    1.7.9
    5.5
    UPDATE:

    I had split my disk in two for this Linode. So I could install another Centos 6.5 to other disk, boot it, and install centminmod from scratch (install default centmin.sh) before upgrade to php 5.5.22 via menu #5.
    The result is before I sudo into root: php -v show correct version
    But when I sudo su into root : php -v show 'command not found'

    So after googling and read some similar problem:
    I tried to fix that by rename php from /usr/bin and then create symlink from correct php version folder (/usr/local/bin/php)
    Code:
    cd /usr/bin
    mv php php-old
    ln -s /usr/local/bin/php php
    
    And now php -v show the version that I want
    Code:
    # php -v
    PHP 5.5.22 (cli) (built: Mar 18 2015 15:48:13)
    Copyright (c) 1997-2015 The PHP Group
    Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
      with Zend OPcache v7.0.4, Copyright (c) 1999-2014, by Zend Technologies
    
    Also now I can use drush (Drupal shell interface) commands without error.
    But of course, please correct me if I'm wrong with that solution.
     
    Last edited: Mar 19, 2015
  11. eva2000

    eva2000 Administrator Staff Member

    54,548
    12,221
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,790
    Local Time:
    10:25 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    interesting issue. Centmin Mod doesn't setup sudo user at all, so that's probably why I haven't run into this issue you have

    Centmin Mod operation and scripts assumes user is running as full root non-sudo based user :)
     
  12. nVidian

    nVidian Member

    98
    8
    8
    Mar 16, 2015
    Ratings:
    +31
    Local Time:
    7:25 PM
    1.7.9
    5.5
    FYI, I always setup sshd_config first before run centmin.sh and change some setting like 'PermitRootLogin no', so I always SSH login with non root user.
    Strange, cause I always do that since older Centminmod version - I forgot the version number but it had nginx version 1.1x or 1.2x.
    And I never had this issue with Centmin mod from that version up to centmin mod version 1.2.3x (which had nginx 1.5x - the last Centminmod version that I used). Newer Centmin mod may has different installation approach ?

    Do you consider this isssue is fully solved with that symlink solution ?

    I truly appreciate your help during this frustrating issue. Thank you so much eva2000.
     
    Last edited: Mar 19, 2015