Open Base Directory Cross Domain - php

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.

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

After installation, blank screen from Reportico

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.

Include file from seperate domain on server: Failed to open stream: Permission denied

I just upgraded Plesk to the latest version and it has caused many of my sites to go down.
The websites all rely on a file which is located on another domain on my server so they all host an index file which contains an include like this:
include('/var/www/vhosts/assets-domain.co.uk/httpdocs/websites/index.php');
I am getting the following error when viewing the website:
Warning: include(/var/www/vhosts/assets-domain.co.uk/httpdocs/websites/index.php): failed to open stream: Permission denied in /var/www/vhosts/this-domain.co.uk/httpdocs/index.php on line 3 Warning: include(): Failed opening '/var/www/vhosts/assets-domain.co.uk/httpdocs/websites/index.php' for inclusion (include_path='.:') in /var/www/vhosts/this-domain.co.uk/httpdocs/index.php on line 3
So there is obviously a permissions problem of some sort but I have no idea where to start.
In SSH I have tried changing the ownership of the folder '/var/www/vhosts/assets-domain.co.uk/httpdocs/websites/' with no luck. I have noticed that all my domains have different ownership usernames now - would this affect it? EG.mydomain.com has the user of mydomain, cooldomain.com has the user of cooldomain - would this be why they can't access each others files?
Please help as I have 15+ websites down :-(
Fixed this - Plesk decided to change the permissions so simply changing the domain name folder to 755 solved this

CKEditor integration with Wiris PHP plugin: open_basedir restriction

As per Wiris guide.
Give execution rights to the web server user on the PHP files contained at to ckeditor/plugins/ckeditor_wiris/integration.
→ My settings: Folder "integration": 755. All files inside this folder: 754
Give write permissions to ckeditor/plugins/ckeditor_wiris/cache and to ckeditor/plugins/ckeditor_wiris/formulas directories to the web server user. Those folders will be used to store formula MathML codes and temporal images.
→ My settings for these folder: 775
However, I get following warnings while trying to open Wiris "Math Popup", and doesn't open properly.
Warning: is_file(): open_basedir restriction in effect. File(/home/my_user_name/public_html/ckeditor/plugins/ckeditor_wiris/integration/../../../../../../../../lib/moodlelib.php) is not within the allowed path(s): (/home/my_user_name:/usr/lib/php:/tmp) in /home/my_user_name/public_html/ckeditor/plugins/ckeditor_wiris/integration/bootstrap.php on line 39
Warning: is_file(): open_basedir restriction in effect. File(/home/my_user_name/public_html/ckeditor/plugins/ckeditor_wiris/integration/../../../../../../lib/moodlelib.php) is not within the allowed path(s): (/home/my_user_name:/usr/lib/php:/tmp) in /home/my_user_name/public_html/ckeditor/plugins/ckeditor_wiris/integration/bootstrap.php on line 39
Are my permissions correct? Do these warnings relate to file/folder permissions? I am using www.serversfree.com webhosting to test this out.
It looks like there's an issue in your installation. Please check the plugin test page:
<url>/ckeditor/plugins/ckeditor_wiris/integration/test.php. There shouldn't be any errors there. Please review the installation instructions at http://www.wiris.com/plugins/docs/ckeditor.
Your permissions are correct. Those warnings are related to an extra check in the /integration/bootstrap.php file, it checks a directory several levels above your working directory and you're not allowed to do so due to an open_basedir restriction in your server. This issue will be fixed in our next plugin release. To supress the warning simply comment the whole bootstrap.php file or add a return true; right after <?php.
Edit: This issue is currently fixed in our latest version.
Please give permission to 777 to folder named cache and formulas
inside path
ckeditor4/plugins/ckeditor_wiris

php filehandling in a symlink doesn't work

I've got some trouble on a apache2 server with using symlink.
The base www folder is in "/var/www//htdocs".
I did a symlink form /home//log" to "/var/www//htdocs/l/" and called it "log".
In my oppinion, all rights are given correctly for the www-data user and the group for .
In my script, i got this error:
Warning: fopen(): open_basedir restriction in effect.File(/var/www/<domain>/htdocs/l/log/logs_test.log) is not within the allowed path(s): (/var/www/<domain>:/usr/share/pear:/usr/share/php:/tmp:/usr/share/phpmyadmin) in /var/www/<domain>/htdocs/l/test.php on line 7 Warning: fopen(/var/www/<domain>/htdocs/l/log/logs_test.log): failed to open stream: Operation not permitted in /var/www/<domain>/htdocs/l/test.php on line 7
This problem should be solved when I add in the apache2.conf the real-path from the symlink. But, and this is my problem: I would not add the real-path for every symlink.
I hope you can understand my problem, if you need some more information, let me know.
Yes the problem is with the open_basedir security restrictions in PHP. You just need to relax the restriction if you want to open files outside the specified directory tree. Read here for more options on how to do this:
http://www.php.net/manual/en/ini.core.php#ini.open-basedir

Categories