PHP require once -
I have a problem with Auth.php
. The file is located on that exact situation and it is located in my WWW is the root of the site.
There is no problem specifying the $ config
variable.
My code:
& lt ;? Includes Php (". / Head.inc"); // Start a new session (required for Hybridauth) session_start (); // If necessary, change the following path $ $ config = dirname (__ FILE__). '/www.bommachine.co.uk/site/modules/ProcessHybridAuth/hybridauth/config.php'; Need_once ("/ www.ommomachine.co.uk/site/modules/ProcessHybridAuth/hybridauth/Hybrid/Auth.php");
My error:
compilation error: require_once (): required to open the required '/ www. Bommachine Co.uk/site/modules/ProcessHybridAuth/hybridauth/Hybrid/Auth.php '(include_path =' .: / Usr / share / php: / usr / share / pear ') (line 11 / var / www / www. Bommachine.co.uk/site/templates/Test.php)
To make sure this is the best and most secure solution.
You can use the method you are already using where you $ Config
. Specify a constant that has the root directory:
define ('BASEPATH', DIRNM (__ FILE__));
Then use where you need the files:
need_once (BASEPATH. "/www.bommachine.co.uk/site/modules / ProcessHybridAuth /hybridauth/Hybrid/Auth.php ");
But please keep in mind that the __ file __
will be the full path to the file in which you are using it if you want it to be / var / www If you use it in /index.php
, then this path will be if you use it in /var/www/subdir/file.php
, then this __ file __ < Will be the value of / code>.
Comments
Post a Comment