After installation, blank screen from Reportico - php

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.

Related

file_put_contents failed to open stream: Permission denied

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

PHP File Uploading Issues

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.

Open Base Directory Cross Domain

Changing the open_basedir directive to work with subdomains works absolutely fine on my server by simply setting the directive to:
C:\Inetpub\vhosts\domain.net\subdomains\beta\httpdocs\;C:\Inetpub\vhosts\domain.net\httpdocs\
However, when I try to do the same from one hostname to another, the open base directory does not work. This is what I am setting:
C:\Inetpub\vhosts\domainOne.net\httpdocs\;C:\Inetpub\vhosts\domainTwo.net\httpdocs\
I know that this can be quite challenging to achieve with FastCGI and PHP, but surely there is an easy fix?
I have tried giving permissions to the user of the current site, on the other sites folder but this has not worked.
The error being returned (as expected) is the following:
Warning: include(): open_basedir restriction in effect.
File(C:\Inetpub\vhosts\domainOne.net\httpdocs_snippets_global\paths.php)
is not within the allowed path(s):
(C:\Inetpub\vhosts\domainTwo.com\httpdocs\;C:\Inetpub\vhosts\domainOne.net\httpdocs)
in C:\Inetpub\vhosts\domainTwo.com\httpdocs\index.php on line 3
Warning:
include(C:\Inetpub\vhosts\domainOne.net\httpdocs_snippets_global\paths.php):
failed to open stream: Operation not permitted in
C:\Inetpub\vhosts\domainTwo.com\httpdocs\index.php on line 3
So my question is, how do I open the base directory cross domain on a Windows Server running IIS 7, Plesk 11 and PHP 5.3 running as FastCGI Application?
Thanks in advance
All sorted, the open base directory setting was indeed correct.
I was on the right lines with adding permissions to the user, I just added the wrong user!
So quite simply, if you run into this, assuming this is the issue you are experiencing, just make sure the user of the website in question also has permissions on the folder and files of the included directory.

move_uploaded_file() gives a Owner/Group error

I'm using move_uploaded_file() to upload images to the server, however it gives the usual error of:
Warning: move_uploaded_file(upload/file.png) [function.move-uploaded-file]:
failed to open stream: No such file or directory in
/home/newuser/public_html/model/account.class.php on line 39
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move
'/tmp/phpuLkUgE' to 'upload/file.png' in
/home/newuser/public_html/model/account.class.php on line 39
This is not permission based as I have set the folder to 777 with root access and ls -l displays it correctly as this.
755 /home/newuser/public_html/model
755 /home/newuser/public_html/model/account.class.php
777 /home/newuser/public_html/upload
PHP Line
move_uploaded_file($_FILES["photo"]["tmp_name"], "../upload/file.png");
The problem I think is down to the Owner/Group setting being configured incorrectly .. a while back I had all of my sites as subdomains in one account:
/home/olduser/public_html/subdomains/index.html
I then changed this and created a new user account to manage a separate website easier and just moved the files across ...
/home/olduser/public_html/subdomains
/home/newuser/public_html/index.html
The new folders in /home/newuser are now owned and grouped as newuser newuser but I think php may be running as nobody olduser so this could be causing the issue?
What can I try to fix this?
Permissions to a particular file / directory don't just apply on the directory itself, but on the whole path leading up to it.
Example:
/home/ - needs 'x' permission (execute)
/home/newuser/ - needs 'x' permission
/home/newuser/public_html/ - needs 'x' permission
/home/newuser/public_html/avatar/ - needs 'wx' permission (execute + write)
It was kind of touched on indirectly in Silver89's feedback under Jack's Answer, but not outright stated - so I wanted to provide an answer to what helped me with this issue which had me scratching my head for a long time. ;)
The best approach that I have found for the destination of move_uploaded_file() is to use the full absolute path. It can vary based on whether you are on a Unix\Linux server or Windows server, but this should give you the basic idea.
On my Unix server at work, you cannot use "../anything" but have to use the full absolute internal file path of /var/www/html/uploads/imagename.jpg.
So that is why your last test worked for you, Silver89 - because your server was probably trying to upload the image to http://yourservername.com/upload/file.png instead of http://www.yourservername.com/yoursubfolder/upload/file.png. It probably threw out the "../" part altogether and that folder didn't exist on the server.
You can find out what that full path name is by logging onto the server (terminal/ssh etc.) and issuing the 'pwd' command or by using PHP code and echoing the getcwd() command in a stripped php file in the folder where your images will go.
This site is helpful in figuring this out based on your server using different PHP Server Config Checking Functions - See the table midway down. You can simply echo these out to the screen such as:
echo $_SERVER["SCRIPT_FILENAME"].
This was a tough one for me so I hope this makes it a little easier for the next person to find - even if this is 8 months old. ;)

Linux: File both exists and not exists

I am writing a PHP application, and I've just encountered a really wierd error. After a recent move to a new (Ubuntu) server, i started getting fatal errors on a require_once statement. So obviously the file doesn't exist, or the file permissions are wrong, right?
No, as it turns out:
The file does exist
The file is checked out from an SVN repository. When I go into the folder and list the files (ls or ls -l) the file is clearly there and has the correct file size. When I update the file in the repository and update the working copy, the changes are copied to the working copy. The file has permissions 755, so everyone should be able so see and read it. Other files in the same directory are working just fine.
The file also doesn't exist:
PHP exits with a fatal error because the file can't be found. If I use the find-command, the file is not found. If I try to use nano to edit the file, it claims it does not exist. If I start typing the filename and press tab to autocomplete, it can't find the file.
This behaviour has now happened on two separate servers, but it works fine on a third server. All the servers run Ubuntu 10.04.
Does anyone have any idea what is going on?
EDIT:
File name is AdminIpv4RangeAddFormHandler.inc.
Full error message, with file paths obscured:
Warning: require_once(fullpath/AdminIpv4RangeAddFormHandler.inc): failed to open
stream: No such file or directory in fullpath/anotherfile.inc on line 34 Fatal error:
require_once(): Failed opening required 'fullpath/AdminIpv4RangeAddFormHandler.inc'
(include_path='.:/usr/share/php:/usr/share/pear') in fullpath/anotherfile.inc on line
34
The following command produces no output:
find -name AdminIpv4RangeAddFormHandler.inc -ls
A regular ls -li outputs (amongst others) this row:
2233407 -rwxr-xr-x 1 root root 1597 2011-12-13 08:02 AdminIPv4RangeAddFormHandler.inc
Be careful switching OS's, as some are case sensitive, and others aren't.
I use my Mac for development (case insensitive), so it doesn't matter what casing I use for file_exists() or include_once() etc. Then I deployed to Ubuntu 11 (case sensitive), and all my includes stopped working. I suspect you have the same exact problem.
The tricky part for me was, while using git, my version control didn't detect changes in file name case as a modification. I actually had to rename every file with some sort of prefix, commit and deploy, rename them back to what they should be (with consistent capitalization!), and finally commit and deploy again. It was a complete pain.
Moral of the story--code for your production system, not your dev system.
Take a good long look at your filenames:
AdminIpv4RangeAddFormHandler # from PHP
AdminIpv4RangeAddFormHandler # from find command
AdminIPv4RangeAddFormHandler # from ls output
^
You should pick IP or Ip and stick with the decision everywhere.

Categories