I installed PhantomJS on my server and it's running great from the terminal. When I try to run form PHP using SHELL_EXEC, I get the following error:
phantomjs: Permission denied
I set the executable to 777 and I just don't know what else to do. Any suggestions?
How did you install it?, and where does it live? The user you're accessing phantomjs with may not have rights to something phantomjs needs.
You should make sure that your web user (I'm assuming it's apache) has +x permission on all the directories in the path for PhantomJS.
Assuming it's /path/to/phantomjs/phantomjs, apache (or its group) need to have +x permission on all /path, /path/to, /path/to/phantomjs.
Related
I am trying to install create a new app in Ruby on Rails and I cannot get passed this error:
$ gem install pg
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # rb_sysopen - /Users/stormyramsey/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/pg-0.21.0/.gemtest
Its a permissions issue. You could fix it with this:
sudo chown -R $(whoami) /Library/Ruby/Gems/*
or possibly in your case
sudo chown -R $(whoami) /Users/stormyramsey/.rbenv/versions/2.3.2/lib/ruby/gems/*
What does this do:
This is telling the system to change the files to change the ownership to the current user. Something must have gotten messed up when something got installed. Usually this is because there are multiple accounts or users are using sudo to install when they should not always have to.
It's likely there's a permissions problem somewhere along the .rbenv path. You might try turning on write privileges for your user with:
$ chmod -R +w ~/.rbenv
That will recursively (-R) change the file mode (chmod) to write permission (+w) for all files and directories under your user's .rbenv path. There's no particular reason for not having files set to write.
For Mac M1 systems try,
Allowing full disk access to terminal.
Apple->systemPreferences->Security&Privacy->privacy(Tab)->'+' button, check in Terminal application.
Then Restart terminal
2.Try using,
sudo chflags noschg
Delete the pod folder, reinstall it again. If it doesn't work use this command:
sudo pod install --allow-root
It really doesn't matter on mac how you configure your eyaml create the dir and config manually, add some public key location to it, and its works just fine after adding full disk access to the terminal as Kewin suggested ^ ^. Thumbs up.
No need to change permission, just export GEM_HOME:
export GEM_HOME="$HOME/.gem"
please run:
sudo gem install pg
I'm setting up my server to listen to a webhook which is currently
shell_exec('git pull 2>&1');
Receiving and executing is working fine, except the to get it to actually replace files I need to give www-data (apache debian) permission to write all the files/folders on my webserver, right?
Currently I'm getting this as a result (no write permissions)
Updating 115da6c..9e82ef0
error: unable to unlink old 'example-path/html.html' (Permission denied)
What are the security implications of giving www-data permission to write files, and is this the right choice or am I doing things all wrong?
Another ways to achieve what you want:
sudo. Configure sudo to run the command passwordless and run shell_exec('sudo git pull 2>&1');.
Create a setuid wrapper that runs git pull and run shell_exec('git_pull_suid_wrapper');.
I have installed linux centos 7 on a VmWare in Windows.
There are two users in the linux: root, sample
I have created a laravel project with user "sample" (logged in as sample), but when I try to run the project with user root (logged in as root), it throws a permission error that cannot write to the file (file_put_content()). I have tried
chmod 777 /var/www/html/laravel
Or even I have tried to change the permission of the write-access of the file to root using right-click->properties->permission, but to no avail.
The only possible solution has been to delete the file and re-create it with user root. Now, what is the solution? I though user root is privileged to do anything. But it seems it is not the case. What is the solution? How should change this issue?
Try chmod 777 -R /var/www/html/laravel/ ,-R is recursive
I installed an application (bagit) via homebrew and am trying to execute a shell command from my local Apache server (installed on OSX).
My PHP looks like this:
$cmd = 'bag create '.$targetFolder.' '.$sourceFolder.' --baginfotxt '.$bagInfoFile ." 2>&1";
$output = shell_exec($cmd);
However, I am getting the following error message:
/bin/bash: /usr/local/bin/bag: Permission denied
How can I give Apache access to the bash command located in `/usr/local/bin?
Your apache install will need to be running as the same user/group as the files its trying to execute.
You can either change the file permissions of the application you are trying to execute to the same as apache/php current user/group (or 777 etc..)
or you can change apache/php to run as a more priviliaged user/group.
Alternatively
You could change the method of your application to SSH into your executable environment and execute the application over SSH.
When PHP tries to exec something, it will do as the default web server user (apache, www-data or httpd). Make sure that the command to run has the right ownership / permissions. The easiest way to reach this is to add your web server user to a new group, lets say test, and chgrp test /usr/local/bin/bag
I get this error while trying to do file_put_contents().
Apache is working as apache group, started with sudo rights. My user is in apache group. All dirs and files have 755 chmod.
File exists.
Locally it works fine, on remote CentOS server not. Why? How to debug that thing?
Sometimes SELINUX will prevent writing as was my problem serving from Fedora. Run:
sudo setenforce 0
This can be solved by changing directory permission.
Run the command like
chmod 777 database (the directory)
You can use getcwd()" to find the directory path.
Please have a look here