Problem with uploading files on root linux server - php

I have a plesk panel and root dedicated server on 1and1. I'm using custom programed php script to upload the files and create the folders to server. I have the upload folder named upload_data_folder with the 777 permission.
The scenario is the following:
I want to create folder in my upload_data_folder and than upload files in that newly crated folder. I'm doing this over php script so every file or folder that I create has apache user and the group as the owner.
I'm successfully crate the folder in my upload_data_folder and that folder is owned by apache, has apache as a group and has 777 premission. Then When I try to upload some files to that newly created folder It can't.
I think the problem is with some owner permission but if anyone has some idea what this can be I would be very grateful

It was my custom made script. huuu I solved the problem. The php safe mode was turned on. After I turned it off everything works perfectly.

By default apache document root is /var/www/html/. If plesk is installed document root will have a path like:/var/www/httpdocs for non-secure sites. Thus secure sites are stored in /var/www/httpsdocs.

Related

Codigniter is not working after uploading to Linux server

Created an application using Codeginiter and is working fine with my local environment which is in XAMPP.
After uploading application folders and files to linux server application is not working at all.
Deployed complete files under "/var/www/html/" and when access from browser it gives me CI error as "404 Page Not Found".
After uploading, I have updated .htaccess file.
I think this is about Linux file permission. You might want to check its file permission.
try to change the permission to read, write and executed by you ONLY example:
sudo chmod 700 var/www/html

php created files ownership

I am having a irritating problem concerning the permissions of files created by Wordpress.
When i download plugins using wordpress or uploading images, and even when a php script creates a dir/files it puts the permissions of this folder into a different user/group.
My user does has no access to this file/folder under my own ftp account.
Is there a way to change files/folders ownership created by apache/php/wordpress to my user ?
If you are using Ubuntu (I don't know if int other distros the files are in the same location) you can edit the file envvars located in /etc/apache2 and restart Apache.
If you can use ACL this is a better solution than changing the user for Apache, more info: https://help.ubuntu.com/community/FilePermissionsACLs
If you want to change the permissions from a php script, you could use the chown() function

Security risk in setting PHP file permissions to full

I'm running XAMPP on Ubuntu, and I copied the lampp folder to /opt/. I also downloaded CodeIgniter to htdocs/, and created and modified some files in it, including changing their permissions. Are there files in CodeIgniter that I shouldn't set permission to full, because maybe then once I upload them onto a server anyone can see their contents?
Ideally, your CodeIgniter should be setup such that the application and system folder lie outside your document root. Only the index.php file along with any assets (images, javascript, css etc.) should lie within the document root.
As for file permissions, 755 works fine. There's no need for full permissions 777.

How to change uploaded file permissions for new files automatically

I recently moved a wordpress site from media temple's gs to their dedicated virtual server.
The file structure changed when I upload files. The permissions automatically upload as 644 and I'd like to change this. Where should I look to change this, the php.ini file or somewhere ont he server settings? It uses plesk.
You're going to want to find a way to change your umask. You might have to talk to your server administrator about it, if you don't have shell access.

Permissions problem when uploading images using PHP in IIS

We have just moved a website to a new server, both servers are Windows Server 2003 running IIS as the web server.
When uploading images we require that the uploaded files have certain permissions for the NETWORK SERVICE account. Images are uploaded using PHP, they are then filtered by ImageMagick using the mogrify.exe binary for resizing purposes and placed in a new folder created by PHP.
The problem we are encountering is that the uploaded file does not inherit the NETWORK SERVICE permissions although the folder does.
I ran filemon to see any errors and get the following:
mogrify.exe:6396 OPEN C:\inetpub\wwwroot\example.com\data\334480\test.jpg ACCESS DENIED NT AUTHORITY\NETWORK SERVICE
The reason we require NETWORK SERVICE access is due to an ASP.NET script we use to resize the image on the fly. I've searched Google but cannot find a solution. Any ideas?
Managed to fix the issue, I changed the upload tmp dir in php.ini to C:\Test and gave Test the permissions I required, I had already made this change but on further inspection upload_tmp_dir is set twice in the php.ini file. Uploaded files inherit the permissions of the temporary directory.
Have you made sure the "NETWORK SERVICE" ACL applies to "This folder, sub-folders and files", wherever it is applied. Also, try making a new folder somewhere else with that same ACL and see if files created by PHP inherit the permission.

Categories