0

I have seen many questions about Running Linux Commands using PHP, but my problem is different. I am using a shared hosting Linux server, and I want to install a package called Poppler-utils using PHP code, because i have no access to the Linux command-line. First I tried to figure out the Distro using cat /proc/version and this is the output:

Linux version 2.6.32-604.30.3.lve1.3.63.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) ) #1 SMP Sun Sep 27 06:34:10 EDT 2015

So I assumed it's Redhat Distro based on the output above. So I tried to install the Poppler-Utils Package using:

exec('yum install poppler-utils',$buffer); 
echo implode($buffer);

As mentioned in this article.

install pdftotext under RedHat / RHEL / Fedora / CentOS Linux

pdftotext is installed using poppler-utils package under various Linux distributions:

# yum install poppler-utils

OR use the following under Debian / Ubuntu Linux

$ sudo apt-get install poppler-utils

But nothing happens at all. So how can I install Poppler-utils in /usr/local/bin/ ?

Any help is appreciated!

5
  • Contact your hosting company, you probably don't have permission. Commented Feb 13, 2016 at 23:46
  • If you are denied command line access, perhaps they also denied you exec access.. Commented Feb 13, 2016 at 23:47
  • But I tried exec('whoami'); and it worked! Commented Feb 13, 2016 at 23:48
  • Yes, but asking information about yourself is something else than requesting super user rights to install a package. Commented Feb 13, 2016 at 23:49
  • yum install requires admin/root/sudo access. It's like on windows when you create a limited user, you can do stuff but not install applications. Commented Feb 13, 2016 at 23:50

2 Answers 2

1

You won't have sudo / root privileges on shared hosting to install files. The only option is to contact your hosting company and to ask for them to install it on the server.

You cant run exec on commands you don't have access to the function e.g. yum or apt-get ;).

Sign up to request clarification or add additional context in comments.

3 Comments

Even if Safe mode is disabled?
Unless the user your account on the hosting has admin rights / in the sudo file / permitted some other way then you cant access those commands.
It's all about permissions, it doesn't matter if exec works.
1

The're no way without root or sudo access. But you can download binaries into your home directory (~/local-bin/ for example) and run stuff from here (don't forget to add ~/local-bin to PATH environment, export PATH=$PATH":~/local-bin"). But the best way - create ticket to support, maybe they can install some packages for you. Or just use Docker on small vps/vds - it's simple and cheap.

1 Comment

Yea, I will be contacting the hosting support, thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.