Basic php and javascript website
No errors on Wamp
When I put the files on my Lamp server everything works except for this error I get on the top of the page
Warning: file_put_contents(donneesDonut.json): failed to open stream:
Permission denied in /var/www/html/bp/action/IndexAction.php on line
101
I looked around and most people suggest to change the permission of the file or the entire directory on apache.
chmod 777 did nothing for me.
I'm new to web servers so I probably have missed some apache configuration for permissions during the installation process
Here is a screenshot of the directory
Directory listing
I don't think there is a problem with the code since it works on my local Wamp server but here is the line of code that gives me the error.
file_put_contents($this->json, json_encode($this->donneesDonut));
If you need any other information like specific apache configuration please tell me where to get them.
Hope you can help
The problem was SELinux with was set to enforce by default on Centos
Related
I've installed Reportico in /reportico under my website root. I set permissions for the folders template_c, projects and projects/admin to READ_&_EXECUTE, LIST_FOLDER_CONTENTS, READ, and WRITE for the user IIS_IUSRS. I've had PHP 5.3.28 running for months with the PDO extension working just fine, so no problems there.
When I browse to:
http://mywebsite/reportico/index.php
...it immediate forwards to:
http://mywebsite/reportico/run.php?project=admin&execute_mode=ADMIN&clear_session=1
...and I get a blank white screen.
I looked in the PHP logs and found this:
[27-Apr-2015 09:06:19 America/Tegucigalpa] PHP Warning: include(templates_c\%%62^620^6206D997%%admin.tpl.php): failed to open stream: No such file or directory in D:\inetpub\inventronicsusa\reportico\smarty\libs\Smarty.class.php on line 1256
[27-Apr-2015 09:06:19 America/Tegucigalpa] PHP Warning: include(): Failed opening 'templates_c\%%62^620^6206D997%%admin.tpl.php' for inclusion (include_path='.;C:\php\pear') in D:\inetpub\inventronicsusa\reportico\smarty\libs\Smarty.class.php on line 1256
This is my first attempt to run Reportico. Any idea what I'm doing wrong?
Peter Deed, the author of the software, was very helpful; he helped me find the answer.
While the web site says:
...ensure that the following files and folders have write permission:-
templates_c
projects - where you will create report suites
projects/admin - for storing the Reportico admin configuration
...just setting Read/Write permission for them is not enough. The software needs the ability to delete from these folders. So, in IIS, that means you have to give it Modify permission in addition to the Read/Write permissions mentioned above.
Hope that helps someone down the line.
I had recently installed Apache, PHP and MySQL in Ubuntu. And copied the files I created to the var/www directory. But when I open http://localhost it is showing
Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0
Fatal error: Unknown: Failed opening required '/var/www/index.php'
(include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0
How can I run my project normally? It was working fine in windows.
According to this article, you need to give read/execute permissions to Owner, Group, and Everyone.
Set permissions on the problem file to 777. Note, you should avoid doing this on a server that's accessible from the internet.
http://webomania.wordpress.com/2007/03/12/permission-denied-in-unknown-on-line-0/
To fix this problem, look at the line in your ErrorLog, to find out which folder it is trying to access.
If a block already exists for that folder, make sure it is set to allow access as necessary. If not, add a block to your Apache configuration file, allowing access as required. See the example below for folder /usr/local/awstats/htdocs.
Order allow,deny
Allow from all
for a complete reference, check the apache wiki
I'm trying to implement script that will allow a file to be uploaded, and then moved to a designated directory. This is running on a Windows server & IIS. I'm having 2 issues in doing so.
First, I get an error when trying to move the file.
Warning: move_uploaded_file(reports/ff.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in C:\inetpub\wwwroot\betterinsight\betterinsight\upload_file.php on line 29
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\Windows\Temp\php1EAB.tmp' to 'reports/ff.jpg' in C:\inetpub\wwwroot\betterinsight\betterinsight\upload_file.php on line 29
Stored in: reports/ff.jpg
When searching, almost everything says it's a permission problem. I have added full rights (will pare down later) to the user: IIS_IUSRS. Even did it to the parent directory as one site recommended.
Second: As a possible solution to the above issue, I tried changing the directory in which files are saved. But the files are still uploaded into C:\windows\temp.
I've run phpinfo, and it says that uploads should be in (as defined by upload_tmp_dir):
Again, this is on a Windows Server 2008. Thanks.
Permission denied
You need to set the folder permissions to 777 or enable read write to the folder. I think the permissions are messing...
OK, the answer was simple. I was adding permissions for user: IIS_USRS, when it should have been just user: USRS.
I've been stuck on this code for days as I am hitting this error when I upload a file to the server. Its a windows server running on Apache
Tried various solutions but still receiving the error. I tried changing full permissions to everyone on that server.
I changed the default PHP upload tmp file to inside my application yet I am still having this error.
Warning: move_uploaded_file(C:\My_Workspace\ojs2002) [function.move-uploaded-file]: failed to open stream: Permission denied in C:\My_Workspace\ojs\admin\include\fileupload.php on line 78
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\My_Workspace\ojs\tmp\phpCB78.tmp' to 'C:\My_Workspace\ojs2002' in C:\My_Workspace\ojs\admin\include\fileupload.php on line 78
// copy the file, making the destination directory if necessary
$filedir = 'C:/My_Workspace/ojs2002/'.basename($_FILES['articlefile']['name']);
chmod($_FILES["articlefile"]["tmp_name"], 0777);
chmod($filedir, 0777 );
move_uploaded_file($_FILES["articlefile"]["tmp_name"],$filedir);
The code would work fine on Linux servers but not on Windows.
Any help would be very much appreciated. Thank You.
I decided to switch from:
move_uploaded_file($uploaded_file, $file_path);
to
file_put_contents($file_path, file_get_contents($uploaded_file));
#unlink($uploaded_file);
The unlink might fail but I'm not too worried about that.
chmod won't work on Windows, as it uses a different type of permission system. Make sure the user Apache runs as has full write access to the folder you're trying to move the files to (right click and click on sharing or permissions depending on the version of windows)
I have a PHP script to copy all files in a directory i have change my server now its not copying index.php file all other files copy successfully and throw bellow warnings.
Warning: ftp_get(tmp/readme.txt): failed to open stream: Permission denied in /var/www/vhosts/Site.com/httpdocs/includes/ftp.class.php on line 123
Warning: ftp_get(): Error opening tmp/readme.txt in /var/www/vhosts/Site.com/httpdocs/includes/ftp.class.php on line 123
Warning: fopen(tmp/readme.txt): failed to open stream: Permission denied in /var/www/vhosts/Site.com/httpdocs/includes/clone.php on line 196
Seems like a permission issue on the new server. Double check the server directory you're accessing to make sure, you and apache have the appropriate permissions.
Like the error message says: Permission denied, in other words your script does not have permission to access the file tmp/readme.txt. Check that the user your PHP script is using has read access to the file/folder. The way to check that depends on what your server setup is so can't give more unless you provide more info about what your server is running.
Welcome to the unix world. It is a permission problem. If you have rights, you can fix it with the command chmod in the server.
$ ssh username#server
$ chmod PERMISSIONS /path/to/filr
check the man page of chmod to understand the permissions. probably you do something like this : +w
It seems this permission issue, not in the new server but in the old server.
Please check owner:group of the index.php file in old server, so that your script can access and manipulate the origin file.
One more thing. Did you run the ftp transfer script, in the browser or in the command line?
This is very important, because one can run the script with APACHE user (www-data) and the other method run the script with your system user.