skip to Main Content

I installed xampp on Ubuntu 22.04.
Running .php files is ok.
Example directory like that.

/opt/lampp/htdocs//helloworld.php

That file worked and run in browser. But when I run php command on terminal, it gave me this error.

error image

I thought this error happened because zsh shell.So I add .zshrc file to this.

export PATH=<path-to-lampp>/bin/php/<php_version>/bin:$PATH

Still not working. Please help.

2

Answers


  1. Chosen as BEST ANSWER

    I got the solution. The problem is need to give symbol link i think.

    My solution: run this command in terminal

    $ sudo ln -s /opt/lampp/bin/php /usr/bin/php
    

    1. Check if your PHP path is right, you should output PHP version by {PHP path} -v.

    2. Do you source /.zshrc after changing the .zshrc file?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search