• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Permission denied

Fran1

New Pleskian
I recently restored a plesk backup due to some problems and now I'm getting some permission denied problems that dont allow my app to run properly.

This is how error log looks like

Warning: include_once(/MyAppPath/db/config/configDB.php) [function.include-once]: failed to open stream: Permission denied in /MyAppPath/db/con.php on line 5

Warning: include_once() [function.include]: Failed opening '/MyAppPath/db/config/configDB.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /MyAppPath/db/con.php on line 5

The line 5 of con.php file is a simple include
include_once dirname(__FILE__) . '/config/configDB.php';

I've checked that
echo realpath(dirname(__FILE__) . '/config/configDB.php');
prints /MyAppPath/db/config/configDB.php which is the expected

These are the permissions

/MyAppPath/db/con.php file:
-rw-r--r-- 1 myappuser psacln 4940 Jun 12 12:34 con.php

/MyAppPath/db/config/ directory:
drwxr-xr-x 2 myappuser psaserv 4096 Jun 12 11:05 config

/MyAppPath/db/config/configDB.php file:
-rw-r----- 1 myappuser psacln 336 Oct 15 2014 configDB.php


I don't understand why apache doesn't have permission to read configDB as stated in error log.
If I run 'chmod 644 configDB.php' then it works, however I think that 640 should be enough (and adequate) permissions.

could be this error caused by the plesk backup restore?? Maybe some issue with SeLinux?

please help me.
Thank you!
 
What is output of

# getenforce

command? Make sure that it has Disabled status.
 
@Fran1,

Try to use an absolute path, it seems to be the case that the basedir is not set properly (i.e. it is unknown to the script running).

If the absolute path does work, then you can work around the issue by declaring the basedir explicitly in the running script.

Kind regards.....
 
Back
Top