This appears to be an unusual problem. I've posted this at Joomla.org and in my site host's forum and no one so far has an answer.
I have a configuration.php file that I want to move outside my public_html folder.
I've tried moving it, renaming it and replacing the original with a require function in the replacement file.
For example:
Original configuration.php resides in:
home/my_folder/public_html/mysite_folder
(It's an add-on domain)
I move the file to:
home/my_folder
and rename it:
something.ext
Then I place a new file called configuration.php in:
home/my_folder/public_html/mysite_folder
with the code:
<?php
require( dirname( __FILE__ ) . '/home/my_folder/something.ext' );
?>
I have also tried the following:
<?php
require( dirname( __FILE__ ) . '/../something.ext' );
?>
Both paths produce the same result. When I try to open the home page in browser I get:
Warning: require(/home/my_folder/public_html/mysitefolder/home/my_folder/something.ext) [function.require]: failed to open stream: No such file or directory in /home/my_folder/public_html/mysitefolder/configuration.php on line 2
Fatal error: require() [function.require]: Failed opening required '/home/my_folder/public_html/mysitefolder/home/my_folder/something.ext' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/my_folder/public_html/mysitefolder/configuration.php on line 2:eek:
Take a close look at the directories in the error. It seems wherever configuration.php is, the entire path above it, from home down is already being set and added on top of the directory I specified somewhere else. I've checked .htaccess, and php.ini,
There is no php.ini, and no .htaccess within "mysitefolder"
.htaccess is in public_html, but only contains server set information for my parked and redirected domains.
There is php.ini within public_html also, which I have not edited. I've only copied what I think is the relative information from it:
; All the values in the php.ini-dist file correspond to the built in
; defaults (that is, if no php.ini is used, or if you delete these lines,
; the built in defaults will be identical).
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
; UNIX: "/path1:/path2"
include_path = ".:/usr/lib/php:/usr/local/lib/php" ;
;
; Windows: "\path1;\path2"
include_path = ".:/usr/lib/php:/usr/local/lib/php" ;
; The root of the PHP pages, used only if nonempty.
; if PHP was not compiled with FORCE_REDIRECT, you SHOULD set doc_root
; if you are running php as a CGI under any web server (other than IIS)
; see documentation for security issues. The alternate is to use the
; cgi.force_redirect configuration below
doc_root =
; The directory under which PHP opens the script using /~username used only
; if nonempty.
user_dir =
; Directory in which the loadable extensions (modules) reside.
extension_dir = "./"
; Whether or not to enable the dl() function. The dl() function does NOT work
; properly in multithreaded servers, such as IIS or Zeus, and is automatically
; disabled on them.
enable_dl = On
; cgi.force_redirect is necessary to provide security running PHP as a CGI under
; most web servers. Left undefined, PHP turns this on by default. You can
; turn it off here AT YOUR OWN RISK
; **You CAN safely turn this off for IIS, in fact, you MUST.**
; cgi.force_redirect = 1
; if cgi.nph is enabled it will force cgi to always sent Status: 200 with
; every request.
; cgi.nph = 1
; if cgi.force_redirect is turned on, and you are not running under Apache or Netscape
; (iPlanet) web servers, you MAY need to set an environment variable name that PHP
; will look for to know it is OK to continue execution. Setting this variable MAY
; cause security issues, KNOW WHAT YOU ARE DOING FIRST.
; cgi.redirect_status_env = ;
; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting
; this to 1 will cause PHP CGI to fix it's paths to conform to the spec. A setting
; of zero causes PHP to behave as before. Default is zero. You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
; cgi.fix_pathinfo=0
; FastCGI under IIS (on WINNT based OS) supports the ability to impersonate
; security tokens of the calling client. This allows IIS to define the
; security context that the request runs under. mod_fastcgi under Apache
; does not currently support this feature (03/17/2002)
; Set to 1 if running under IIS. Default is zero.
; fastcgi.impersonate = 1;
; cgi.rfc2616_headers configuration option tells PHP what type of headers to
; use when sending HTTP response code. If it's set 0 PHP sends Status: header that
; is supported by Apache. When this option is set to 1 PHP will send
; RFC2616 compliant header.
; Default is zero.
;cgi.rfc2616_headers = 0
Host is currently running:
Apache version 1.3.37 (Unix)
PHP version 5.1.6
What can I do to ensure that apache(?) is looking at the specified directory as absolute instead of relative?
Does it have anything to do with "include_path" in php.ini?
I'm guessing I may need to alter either php.ini, or .htaccess, but no idea what would need to place in them, or maybe I need to contact the host about this.
Any help would be greatly appreciated!😉