All Questions
Tagged with php permissions
162
questions
-2
votes
1
answer
46
views
Unable to move uploaded files with php (Apache 2.4) - Permission denied
In my project I can't use move_uploaded_file PHP function because of:
Notice: PHP Request Startup: file created in the system's temporary directory in Unknown on line 0
Warning: move_uploaded_file(.....
0
votes
1
answer
142
views
Cannot execute PHP binary as non-root user in Plesk server (Linux)
I am running Plesk 18.0.44 on my Debian 9.13 server. It has multiple subscriptions and hence different users for these vhosts. I was always able to run /opt/plesk/php/7.4/bin/php -v as a vhost user (...
4
votes
1
answer
835
views
How to make get_current_user() return the same user as $_SERVER['AUTH_USER']?
I have a PHP app that uses LDAP for logging in. The app is served on Windows Server with IIS.
In the past, I was using $_SERVER['AUTH_USER'] to get the remote Windows user that was using the app:
$...
0
votes
1
answer
2k
views
Apache2 server PHP access to files outside document root
I have a Raspberry Pi that I use to host a web server. I am using apache2 2.4.38, php8.1 and MariaDB 15.1 and I wanted to add a Nextcloud server to it. I am using the web installer version. I already ...
0
votes
0
answers
117
views
Prevent Apache from writing to a file
I have a website based on a CMS, running on Apache 2.4/PHP7.4. The CMS has an admin interface and changes you make there are written to config files inside the web root (/var/www/html/...). As a crude ...
1
vote
0
answers
256
views
Apache mod_userdir and php permissions
I have a setup with many users, who can host their personal webpage (served by apache via mod_userdir), located under public_html in their homes. php support is also enabled in apache.
At the moment I ...
1
vote
0
answers
298
views
Php send mail from Cron (postfix + sendmail)
I have a PHP script that I run from cron. I never get emails.
maillog:
postfix/sendmail[2223187]: fatal: execv /usr/libexec/postfix/smtpd: Permission denied
Command-line:
* * * * * root /usr/bin/php /...
0
votes
0
answers
487
views
-bash: /usr/local/bin/php: operation not permitted
Why I am unable to execute any command that requires php. For instance
[root@server ~]# composer -V
"/usr/bin/env: php: Operation not permitted"
Here is the permission on where composer is ...
0
votes
1
answer
489
views
How to change file permissions with Cpanel or Filezilla for MantisBT or any file / folder? [closed]
I would like to install Mantisbt on a shared hosting account. I'm not a developer or network engineer myself but I found easy to follow instructions here: https://www.tmdhosting.com/kb/answer/re-...
1
vote
1
answer
69
views
Correct way to set up users and permissions for server side scripts that write to files?
I have an program that runs on my server (AWS EC2), which does some computing and produces some log files. The program is C++ but is launched from a PHP script via web.
What is the "correct" way to ...
1
vote
1
answer
3k
views
PHP Script and correct permissions for user to change everything
The network configuration doesn't allow access to FTP from outside the building. There's one user that need to upload and change files from a specific folder so I've installed TinyFileManager
https://...
6
votes
1
answer
2k
views
PHP FastCgi running as IUSR instead of IIS APPPOOL/xxx
An IIS website is run via an Application Pool which has its Identity advanced property set to ApplicationPoolIdentity. The website runs PHP scripts via a FastCGI handler. These scripts try to write to ...
1
vote
0
answers
3k
views
How to deny php files and allow some with Nginx?
I use on my site Drupal 8, the library "shariff-backend-php".
https://github.com/heiseonline/shariff-backend-php
When my server was on Apache, I had to add to my htaccess file the following line, ...
2
votes
1
answer
442
views
How to prevent PHP on a virtualhost/website from writing to another virtualhost's/website's directory on the same Apache server?
I want to prevent virtualhost #1 from writing or reading to virtualhost #2 without losing writing access to the www-data at all (because the applications need to write to the directory).
My current ...
1
vote
1
answer
63
views
give apache ID permissions to list and CRUD files as OS users
I wasn't sure if this question belongs here or on SO. I can move it there if needed.
In any decent Apache configuration, Apache will run as its own ID; www-data for example. And this ID will not have ...
0
votes
1
answer
330
views
Wrong file owner on webserver but how?
OS:
CentOS 7.1
Applications:
NginX: 1.14.0
PHP-FPM: 7.1.17
I have a webserver that has NginX and PHP-FPM running. Both applications are running by the user nginx. However, when my Laravel ...
0
votes
1
answer
781
views
Write permission error in /tmp in python call to MySQL on Centos 7
I have a python (3.6 anaconda distribution) scrip on Centos 7 which at some point executes a simple query of the following structure
import MySQLdb
cursor = cnn.cursor() # cnn is the open ...
0
votes
3
answers
10k
views
Apache www permissions for php script
I have a php script which run a private social network.
It's running on a Ubuntu 16.04.03 with an mariadb and apache 2 and php7 config.
I have created a new folder in /var/www/myscript and copied ...
3
votes
2
answers
31k
views
phpmyadmin forbidden in Nginx although permited
I fail to understand why entrance to PHPmyadmin is forbidden (http://my_ip/phpmyadmin). Here's what I did to install it:
On a pure Ubuntu 16.04 machine (server, xenial) I've installed LEMP with php-...
1
vote
1
answer
265
views
Problems with session data permissions, multiple UIDs on multiple PHP-FPM pools
I run an nginx server with 40 identical webapps on 40 different ports in 40 different PHP-FPM pools. Each pool is run on a separate user.
My sessions.save_path in php.ini is /tmp/php_sessions. Let's ...
0
votes
1
answer
334
views
Apache And PHP Permissions
I have a server using ubuntu server, with apache2 and php.
I want to setup a directory with a php file, that is visible to the internet,and inside it, a directory that is private, and no one (apache) ...
1
vote
1
answer
682
views
Centos 7 Selinux issue I think? php cannot read or write
I have an uploads folder for my web application: /disk2/app/uploads.
ls -Z returns:
drw-r--r--. apache apache unconfined_u:object_r:httpd_sys_rw_content_t:s0 uploads
ls -Z / returns:
drwxrwxrwx. ...
-1
votes
1
answer
939
views
Executing external file as www-data (Ubuntu 16.04)
I want to start a virtual machine through PHP, but i've had no luck. Here's what i've got.
<?php
if(isset($_POST['btn_start'])){
echo shell_exec('whoami');
echo exec('virsh start winagain');
}...
1
vote
1
answer
1k
views
Proper permissions on FreeBSD with nginx and php for multiple users
I am trying to set up a multi-user FreeBSD server using nginx.
Here are my steps so far:
In my /usr/local/etc/nginx/nginx.conf file I set user www www; so that nginx acts as the www user, part of ...
0
votes
2
answers
626
views
PHP/Apache Can't Write To Anything
I've been encountering an issue on a client site for the past couple of weeks where they can't upload files to a directory outside of the web root.
After looking in the error logs, it looks like PHP ...
0
votes
1
answer
1k
views
SELINUX won't allow to upload images [duplicate]
I have a Centos 7 server with nginx and PHP7 and have a Problem with SELINUX if the SESTATUS is Enforcing I cannot upload images but if the Status is permissive it works. I host Magento on that Server ...
0
votes
1
answer
1k
views
PHP can't write to a directory
I am trying to configure our server for a client's website that we host. Their site is PHP, which I'm not terribly familiar with, so I don't know if it works in some weird way. (All our sites are in ...
4
votes
2
answers
31k
views
Allowing PHP to run specific bash script with root permissions
I have a php script calling a bash script like this:
<?php
$result = exec('sudo /bin/bash /var/www/my_bash_script.sh /var/www/vhosts/testsite/htdocs/');
var_dump($result);
?>
This is ...
1
vote
2
answers
698
views
Wordpress plugin update/install failure
I've been reading all sorts of information all over the web on this topic. I just installed Wordpress on my Fedora 22 box, x64. The installation went perfectly, I'm able to access the site, but cannot ...
1
vote
1
answer
2k
views
PHP exec() over UNC path on Windows
My environment is Windows Server 2012 R2, IIS 8, Active Directory, and a file share. IIS, AD, and the file share are all separate VMs.
I have a website, www.example.com, set up in IIS. The ...
1
vote
1
answer
290
views
Why does a new application pool identity have write access?
I am running IIS 8.5 with PHP (various versions) via FastCGI. Impersonation is on in the PHP config for FastCGI. The app pool is set to use the App Pool Identity. In fact, if I actually ...
1
vote
0
answers
7k
views
PHP exec() Returns 127 When Trying To Run Any Command
I'm an intermediate Linux user (CentOS, some Debian) who is transitioning to FreeBSD (10). Permissions have always been somewhat confusing to me.
I've set up a server with PHP-FPM (5.6) and Nginx (1....
1
vote
3
answers
3k
views
how to keep file and folder permissions from changing
I have a directory of files and folders that are added and removed and the permissions that I had set keep changing. How can I permanently keep the permissions on a specific path so that no matter ...
-5
votes
2
answers
166
views
Why isnt this sudoer command run as root? [closed]
I want to give PHP access to a very specific script using a configuration under /etc/sudoers.d.
So I did the following:
visudo -f /etc/sudoers.d/99-php
And entered this sudo rule:
www-data ALL = (...
0
votes
0
answers
2k
views
Open LiteSpeed permission problems
I recently moved to open litespeed from apache and i can no longer create files.
When i do a file_put_contents i get permission errors.
lsphp and litespeed both run under user nobody.
Doing a chmod ...
0
votes
4
answers
5k
views
Permissions set to 555. How can another user modify the files? [duplicate]
I run an Ubuntu 12.04 x64 VPS with Vesta, and a site in PHP. It has been hacked several times with injected code that looks like this:
<?php $KoDgalxVvsZfidVcEOTJDeMX='ba'.'se6'.'4_deco'.'de';eval(...
1
vote
1
answer
4k
views
permission denied when script tries to run
I have a PHP script that run's the following command using exec()
/root/gsutil/gsutil <COMMAND>
In my error logs I receive the following:
sh: 1: /root/gsutil/gsutil: Permission denied
Does ...
0
votes
1
answer
520
views
Make error_log readable by apache
Setup: CentOS 6.6, Apache 2.2.15, php 5.5.21
I 'm building a php script that displays the content of the /var/log/httpd/error_log file. Unfortunately, it does not work. The error message states:
...
2
votes
1
answer
3k
views
PHP cant write files regardless of permissions
On a Centos 7x64 box apache/php is unable to write files regardless of permissions. I set the directory to apache:apache and even set it to 777 and php is still getting permission errors.
What else ...
1
vote
3
answers
437
views
Delete file as different user under PHP
I'm running PHP as user www-data and Nginx is running as user nginx. I need to delete files in /var/cache/nginx/, which is owned by user nginx and I want to do it using PHP.
Is there a way to allow ...
1
vote
1
answer
7k
views
CentOS 7, SELinux, PHP, Apache: How to set default permissions to new or updated files in an directory?
Server info:
CentOS Linux release 7.0.1406 (Core)
PHP 5.4.16 (cli) (built: Sep 30 2014 09:44:39)
SELinux enforcing
Apache/2.4.6 (CentOS)
My PHP-Script needs to read from a home directory ...
0
votes
2
answers
1k
views
Disallowing interactive login for specific mysql users
I want to create some mysql users for different web sites but disallow interactive connections for them.
If a evil-user get the mysql login credentials of a website, creating a conexion from ...
2
votes
3
answers
15k
views
owncloud refusing to access data directory
I am trying to fix an OwnCloud sever. I am stuck since a day, and I am starting to despair. Owncloud (set up on arch linux) says:
Data directory ( /data/ocdata) is invalid
Please check that the data ...
0
votes
1
answer
2k
views
Apache can't read files outside of webroot
It has been many, many moons since I've set up an Apache server. I'm assuming some things have changed.
The new one I'm doing is on AWS (Linux). It's installed fine with PHP support. I installed ...
0
votes
2
answers
4k
views
How to let user create folder and upload file, lamp permission [closed]
I use mkdir($folder_path, 0755) in localhost(MAMP) it works, but after I move to VPS I use LAMP it failed.
Folder
the direction path is /var/www/html/assets/images/ the images folder info:
Owner: ...
1
vote
2
answers
7k
views
How can I set the default permissions for files uploaded by apache2?
When I upload files through php, it writes the file with the permissions 644 (-rw-r--r--).
I have my /var/www/html folder setup with setgid, so that all files uploaded are set to a group that should ...
3
votes
2
answers
10k
views
Nginx PHP-fpm permission
When i'm setting the user in nginx.conf to root root:
user root root;
then my website is working, but when i set it to nginx nginx i get error in the logs:
connect() to unix:/var/run/php-fpm/php-...
1
vote
2
answers
2k
views
Why can nginx access /etc/passwd? [closed]
I'm trying to setup my new VPS with my couple sites.
nginx, php-fpm and other needed services installed.
I setup a nginx server block(virtual hosts) for my site, and then try to create a php file ...
1
vote
0
answers
3k
views
Can't write files with PHP on IIS
I have an IIS 7.5 web server running on Windows 2008r2. When I try to write to a file I get a Permission Denied error, but I can't figure out how to fix the permissions.
I have PHP configured via ...
1
vote
1
answer
559
views
Restrict VSFTPD virtual user to respective directory
I'm using Ubuntu 13.10 with vsftpd, and trying to limit a FTP user to their respective directory.
For this, I am using the following
My vsftpd.conf :
local_enable=YES
write_enable=YES
local_umask=...