Sudo php

Problems with the Linux version of XAMPP, questions, comments, and anything related.

Sudo php

Postby youms » 30. January 2020 18:29

I have set /opt/lampp/bin as environment variables
I can't use php in sudo mode, "command not found". Can i use the php in xampp to compile files from terminal ini root mode? I do not want to install default php on ubuntu.
youms
 
Posts: 2
Joined: 30. January 2020 17:56
XAMPP version: 7.2
Operating System: Ubuntu

Re: Sudo php

Postby Nobbie » 31. January 2020 10:27

youms wrote:I have set /opt/lampp/bin as environment variables


What does that mean? What did you do exactly?
Nobbie
 
Posts: 13175
Joined: 09. March 2008 13:04

Re: Sudo php

Postby youms » 31. January 2020 10:45

I set this in my environment path so that I could use the Php that is installed with XAMPP in any terminal I open (/opt/lampp/bin)
I could execute basic Php commands like Php app/console to use Symfony frameworks. Unfortunately I can't use that same Php with sudo.
Sudo php gives me as output "Php not found"

Whereas if I install Php with sudo apt install php7.2-cli, sudo php will work great.
youms
 
Posts: 2
Joined: 30. January 2020 17:56
XAMPP version: 7.2
Operating System: Ubuntu

Re: Sudo php

Postby Nobbie » 31. January 2020 12:36

That is a linux problem (not Xampp). Sudo uses a so called "secure_path", configured in /etc/sudoers. It does not use PATH variable. See /etc/sudoers and read the manual about "sudo".

Anyway

Code: Select all
sudo /opt/lampp/bin/php


should do it as well.
Nobbie
 
Posts: 13175
Joined: 09. March 2008 13:04


Return to XAMPP for Linux

Who is online

Users browsing this forum: No registered users and 117 guests