Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It works fine from ssh buy not from PHP, why ? #40

Closed
bil80 opened this issue Sep 5, 2022 · 2 comments
Closed

It works fine from ssh buy not from PHP, why ? #40

bil80 opened this issue Sep 5, 2022 · 2 comments

Comments

@bil80
Copy link

bil80 commented Sep 5, 2022

Hello, i installed it successfully, it works without any issue from a ssh command line, but when i run it from a PHP page, there is no output, and there is no errors on the log file. Is there any settings to do ?

@conrad10781
Copy link

If you posted your PHP script, I could better answer, but presuming you're doing something like the following and it's "not working":

$output = `backgroundremover -i "FILE.jpg" -o "FILE.png"`;

And through your shell ( ssh command line ), you're doing the following and it is working:

backgroundremover -i "FILE.jpg" -o "FILE.png"

You would have multiple issues. First being that you would want to use the full path to backgroundremover ( run "which backgroundremover" without the quotes ), but you're going to see it's installed in a local users .local/bin directly probably and not the more common /usr/bin, which is going to leave you with the next issue.

Are you running the PHP through a web server or the command line? If the command line, as long as you're running the command as the same Linux user that installed it and who you're SSH'd in as, just make sure you're using the full path.

If you're running it through a web server, that is likely being run through a different user than your Linux user ( IE "www-data" on Ubuntu in Apache ). It may still work using the full path, but you will likely run into permission issues ( which you could circumvent with chmod's that may create other issues ). So you will either need to install the package again globally or to setup a true home directly for www-data ( or whatever the user is ) and install it there, and again still use the full path in PHP.

@nadermx
Copy link
Owner

nadermx commented May 5, 2023

This is more PHP code than a issue with this package. Try https://stackoverflow.com/questions/25230686/using-the-exec-command-php

@nadermx nadermx closed this as completed May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants