I have thoroughly checked for an answer to this question but it seems like not one off the countless answers has helped me.
I would appreciate some guidance.
I have a website that I am accessing remotely via the clients public IP address. I have installed and configured WAMP Server with Apache 2.4.27. The machine is also running PHP 5.6.31.
What I am trying to do is allow a tax payer to upload supporting documentation to a folder using a script that I wrote called upload.php. I have tested the program on my local environment and it works. I should add that the bulk of the code for the website is written in a compiled dBASE executable that resides in the cgi-bin.
I am able to navigate to the page in which I allow the user to select a file and upload it, but when I click the upload button, I get an error message that states.
You don't have permission to access /upload.php on this server.
Apache/2.4.27 (Win64) PHP/5.6.31 Server at 24.148.115.174 Port 8000
I have configured my virtual host to allow access to the Wamp64/www directory.
I have no idea why this is not working. If you need to see the httpd.conf file, let me know. Thank you in advance.
try use: chmod 777 upload.php maybe your apache user don't have permission to access upload.php.
I feel foolish. My vhost.conf file was still set to
VirtualHost *:80.
I changed it to
VirtualHost *:8000
and that fixed the problem. Thank you to everyone for their advice.
Related
Sorry if this a repeat of a question that has been asked before but I have not been able to find my exact situation. We are trying to migrate our website server from a Windows 10 VM (yes I know) to a Windows Server 2019 VM. We have some PHP on our site that writes files to some of our other servers on the same domain and have been able to do so without issue using file_put_contents like so:
file_put_contents("\\\\server\\folder\\folder\\folder\\".$filename, $file);
Now all of a sudden, to run the same code on our new server I get a Warning on this line, "Failed to open stream: Permission denied". I have permission to access this folder, I can browse to \server\folder\folder\folder and create a file there. I even tried mapping this server to a letter drive on my new web server, and still same error. I can put the file on the local C drive just fine but that's it.
Running fileperms on the folder path gives Warning: fileperms(): stat failed. Running is_writable on the folder path returns false, I just can't see how. Running it on the old Windows 10 web "server" returns true. I've read some things about needing to enable certain settings on the server you're trying to access, but I just can't think of what would allow one VM to access it and not another. Both VM's are logged in with the same user with admin rights. I can bring up the same folder in file explorer and write to it, just not via PHP. What obvious thing am I missing?
Thanks!
After weeks of banging our heads against the wall we finally figured this out. On our old web server, when right-clicking the website from the Sites file tree in IIS, under Manage Website -> Advanced Settings, the Physical Path Credentials field was set to the credentials needed to access these folders. On the new server it was blank. I'm not sure how this got missed but in any case, after entering the correct credentials here everything immediately worked.
I have my site hosted on GoDaddy and on that site I have a part for uploads, it worked fine until days ago, now it started to return error 6 - Missing a temporary folder for any file I try to upload, I tried several ways to solve it, changing the php.ini and still nothing.
In my PHP file if I use the command file_exists(sys_get_temp_dir()); returns me true, so the folder is there.
If I use the is_writable(sys_get_temp_dir()); command returns me false, maybe there is the problem, but the folder /tmp on my server has permission drwxrwxrwt.
If anyone can help me with this problem, since I followed several tutorials and nothing about the solution.
Some providers do NOT grant access to the initialization file for PHP, but rather customers must use a local php.ini file with only the entries needed and allowed to set in a customer account.
In the server's Site Administration menu -> Server -> PHP Info what does the output show for upload_tmp_dir?
More than likely on a shared host, one cannot access edit the main php.ini, but one can set some things via their own local (in their account) php.ini file with the right 'snippets'.
Good luck, hope this helps.
Well, the problem has been solved and it is more strange than I imagined, I will leave the answer here to help you if someone has the same problem.
It was necessary to execute the command chmod 777 / tmp, but this command could not be executed since it gave an error that the folder was read-only (Ready-Only file system). To resolve this, it was necessary to mount and remount it, but I couldn't do it either, as it wouldn't let me remount the /tmp folder
For another reason I had to restart the server and magically the server let me change the permissions to 777 (from drwxrwxrwt. to drwxrwxrwx.). With that problem solved.
I thank everyone who tried to help.
UPDATE 28/07/2016
Help me please.
My problem is I have a ubuntu server with the following configuration
In summary ::
my internal server (tomcat 7) .war owner user does not have permission to create, modify, ... folders, upload files (but yes, to read all this).
my module in plesk is apache (is not whether it would be better, CGI, or FAST-CGI).
I've tried everything, changed owners folders permissions for adding groups, more users, I modified mod_jk, I changed server.conf, worker.properties, tomcat.users, catalina.policy, ........
And I can not get the user and owner (tomcat7) .war, achieve create, modify, delete folders, upload files etc ...
However from the local tomcat, which makes the request when the user is www-data, you can do all.
can someone please help me with some idea?Thanks.
I finally had to switch to a windows server because of problems with plesk and ubuntu.
and voila, everything working properly
Hie,
I have installed a new httpd server and loaded my web application on it which is designed to upload files on the server. Also it creates new directories and files inside the web directory of the application. But i am unable to use these features because it gives me a permission denied error. I searched onto the web and got the clue that i require to enable ftp login through my PHP script. I changed the ownership and permissions but it is still not working. Can please someone explain the configuration required in simple steps to enable these features. I am using CentOs-6. It will be highly appreciated. Sorry for the miss formed question.
Configurations I tried out:
Create a Linux user and group named webuser. Give it permissions of
the directory of my web applications. Install Vsftpd and allow webuser
to login. Set webuser FTP root directory same as my Web Application
directory (i.e /var/www/mysite)
My httpd user is apache.
I was doing everything right. The only problem was CentOS SELinux. It was not allowing apache to write files into the web directory.
Using the command "setenforce 0" , i closed it down and everything started working.
Later, I added an exception into my SELinux policies to fix issues.
open function working in local server but not working on mail server
Very popular trouble:
Your local server works under Windows OS, so you can access your file without any trouble. But when you migrate from Windows to Linux, FreeBSD or other hosting you get "Access denied" error. So, you need to change access permissions to your file with FTP client or SSH.
Google for changing file permission. You will get a lot of step-by-step instructions for chmod linux command, SSH and s.o.
It will be much better, you post here some PHP output, such as warnings or errors.
Like Andrew said, it's probably a file permission problem.
If you're trying to open a remote resource (using a network protocol), you should check your phpinfo(): the configuration key allow_url_fopen must be set to on.
Could you copy/paste more details about your problem?
PHP version
complete error trace
file permissions