0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

how to change cli php ver. on xserver

Last updated at Posted at 2025-02-05

Summary

To install latest Laravel ver.11 on xserver, I needed to switch php cli ver. to the latest
(at least to cli ver8.2). Here are some tips what I found.
image.png

image.png

Points

Symbolic Link needs to select the absolute path(/opt/php-8.2.22/bin/php)

Steps

  1. Check php path by ls -la, basically it will be on /opt/php...
    rwxrwxrwx 1 root root 27 9月 3 10:45 php-fcgi8.2 -> /opt/php-8.2.2/bin/php
  2. Set that symbolic link ln -s /opt/php-8.2.2/bin/php $HOME/bin/php
  3. .vi ~/.bash_profile
  4. Change PATH=$PATH:$HOME/bin to PATH=$HOME/bin:$PATH
  5. Execute source ~/.bash_profile
  6. Run php -v to check new version.
    image.png
  7. Run laravel new <ProjectName> to install latest laravel. now it worked.
    image.png

Failure

I set the sybolic link below but it failed because it was not the resource file.

ln -s /usr/bin/php-8.2 $HOME/bin/php

Correct link is

ln -s /opt/php-8.2.22/bin/php $HOME/bin/php

Tips

IF already existed the symbolic link, do below to unlink.

unlink /home/<username>/bin/php
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?