• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

PHP Require Fails

O

oddconcept

Guest
I am a newbie to linux... So please excuse my ignorance...

I have a Fedora Core Linux Box running Plesk 8. It is a clean install and I just setup a couple of my personal Domains.
Everything running OK.

I have a folder (Connections) on one of my sites that I use to store my database connection scripts to MySQL.

I can do a simple require
require($_SERVER['DOCUMENT_ROOT'].'/Connections/connRemote.php');

Everything works great. I can call this from anywhere no problem.

However, when I set the permissions on the folder (Connections) to 750 so that the outside world cannot access my user names and passwords. It fails.

I have logged in SSH to see the permissions on the folder.
owner name is correct (it's the user name for the domain)
group name is set to "psacln"

Is that correct? Should this be changed.
Do I have to set something in the php.ini file for php to run as the user psacln?

Where would this type of error be logged?

Any help would be greatly appreciated...
Atleast a kick in the right direction :)
 
Does anyone at least know what the "psacln" user is?

Does anyone have this user as "Group" user on all their domains?

This seems a little odd to me.

Please, any help would be greatly appreciated?
 
The errors are logged to ~domainuser/statistics/logs/error_log which is only accessible to root (you could also just turn on displaying errors in the script your creating). psacln is not a user, it's a group and all Plesk Clients are in that group, that's normal.
 
It simply says that permission is denied??

If all Plesk Clients are in that group (psacln), then I should have no problems Setting the permissions on the Connections folder to (rwx r-x---) because the group psacln should have read and execute permissions to that folder.

Am I on the right track here? Please let me know if I am completely wrong...

Could it be that PHP uses a different user when executing its scripts? I noticed in the phpinfo() it states:
under apache2handler section
user/group = apache(48)/48

Do I have to make apache(48)/48 a member of the psacln. Is that safe??? If so how do I do that?

This is the Error:

PHP Fatal error: main() [<a href='function.require'>function.require</a>]: Failed opening required '/var/www/vhosts/mydomain.com/httpdocs/Connections/connRemote.php' (include_path='.:/php/includes') in /var/www/vhosts/mydomain.com/httpdocs/remote/update.php on line 1


THANKS AGAIN FOR YOUR HELP!
 
PHP scripts are indeed executed as user apache (sadly Plesk still doesn't use something like suPHP). Just leave permissions for your directory at 755 (drwxr-xr-x) and you should be fine.

Also note that Plesk by default sets up an open_basedir restriction which makes sure PHP scripts on a certain domain only have access to other files within that domain's httpdocs dir, plus the /tmp dir.
 
Thanks for all your help!

But I still don't understand how do I protect this directory from being seen by outside users. I use to use C-Panel and thats how I protected the directories. Is there another solution that I am not aware of?

Thanks again fo rall your patience and HELP! :)
 
Originally posted by breun
Also note that Plesk by default sets up an open_basedir restriction which makes sure PHP scripts on a certain domain only have access to other files within that domain's httpdocs dir, plus the /tmp dir.

I guess this is causing problems for me. Could you tell where one can change these default settings?

Thanks a lot!
Algirdas
 
Back
Top