logo
down
shadow

Referencing a file using Document Root


Referencing a file using Document Root

By : N.Ashtari
Date : November 21 2020, 04:03 PM
wish help you to fix your issue to everybody who commented and responded. After spending quite a while on three different tech support calls with GoDaddy, we finally figured out that the problem was on their end. No code changes required.
I'm really sorry to have wasted everybody's time. Thank you all very much!
code :


Share : facebook icon twitter icon
PHP file outside doc root needs files outside and inside the document root

PHP file outside doc root needs files outside and inside the document root


By : user2060428
Date : March 29 2020, 07:55 AM
this will help PHP will not be able to resolve the location of your alias_directory.php file. You will need to supply the location of the alias_directory.php file yourself. Either as an absolute path, or relative to alias_directory2.php or the DOCUMENT_ROOT
Example:
code :
If your file locations look something like this:
/var/www/webroot.php
/var/otherdir1/alias_directory.php
/var/otherdir2/alias_directory2.php

From alias_directory2.php you can now include alias_directory.php by either:
require_once('/var/otherdir1/alias_directory.php');
or
require_once(dirname(__FILE__).'/../otherdir1/alias_directory.php');
or
require_once($_SERVER['DOCUMENT_ROOT'].'/../otherdir1/alias_directory.php');
The root element must match the name of the section referencing the file

The root element must match the name of the section referencing the file


By : Zh handry
Date : March 29 2020, 07:55 AM
wish helps you Here is my follow-up answer based on the OP's recent comment: What if I have more than one external config file?
My suggestion is to revise the design of the configuration settings. I assume that you have multiple class libraries, and each class library has its own set of settings that are currently being stored in the appSettings section. In that case, your config file probably looks something like this:
code :
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <!-- App Settings for Class Library 1 -->
    <add key="ClassLibrary1Value1" value="123"/>
    <add key="ClassLibrary1Value2" value="234"/>
    <add key="ClassLibrary1Value3" value="345"/>
    <!-- App Settings for Class Library 2 -->
    <add key="ClassLibrary2Value1" value="ABC"/>
    <add key="ClassLibrary2Value2" value="BCD"/>
    <add key="ClassLibrary2Value3" value="CDE"/>
  </appSettings>
</configuration>
        var appSettings = System.Configuration.ConfigurationManager.AppSettings;
        Console.WriteLine(appSettings["ClassLibrary1Value1"]);
        Console.WriteLine(appSettings["ClassLibrary1Value2"]);
        Console.WriteLine(appSettings["ClassLibrary1Value3"]);

        Console.WriteLine(appSettings["ClassLibrary2Value1"]);
        Console.WriteLine(appSettings["ClassLibrary2Value2"]);
        Console.WriteLine(appSettings["ClassLibrary2Value3"]);
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="classLibrary1" type="System.Configuration.AppSettingsSection"/>
    <section name="classLibrary2" type="System.Configuration.AppSettingsSection"/>
  </configSections>
  <classLibrary1 configSource="ClassLibrary1.dll.config" />
  <classLibrary2 configSource="ClassLibrary2.dll.config" />
</configuration>
<?xml version="1.0" encoding="utf-8" ?>
<classLibrary1>
  <add key="Value1" value="123"/>
  <add key="Value2" value="234"/>
  <add key="Value3" value="345"/>
</classLibrary1>
<?xml version="1.0" encoding="utf-8" ?>
<classLibrary2>
  <add key="Value1" value="ABC"/>
  <add key="Value2" value="BCD"/>
  <add key="Value3" value="CDE"/>
</classLibrary2>
        var classLibrary1AppSettings = (System.Collections.Specialized.NameValueCollection)System.Configuration.ConfigurationManager.GetSection("classLibrary1");
        Console.WriteLine(classLibrary1AppSettings["Value1"]);
        Console.WriteLine(classLibrary1AppSettings["Value2"]);
        Console.WriteLine(classLibrary1AppSettings["Value3"]);

        var classLibrary2AppSettings = (System.Collections.Specialized.NameValueCollection)System.Configuration.ConfigurationManager.GetSection("classLibrary2");
        Console.WriteLine(classLibrary2AppSettings["Value1"]);
        Console.WriteLine(classLibrary2AppSettings["Value2"]);
        Console.WriteLine(classLibrary2AppSettings["Value3"]);
AS3: Really weird "inaccessable" error when referencing document root object

AS3: Really weird "inaccessable" error when referencing document root object


By : LibFlow
Date : March 29 2020, 07:55 AM
like below fixes the issue In the event that my comment is buried, I'll formalize it as a response:
Get rid of the static class reference and the quasi-singleton style access to your document class. Instead, use dependency injection like this:
code :
public function PClient()
{
    // Trace
    trace("Client(): Client initiated");

    // Create session handler/loader
    _sessionLoader = new PSessionLoader(this);

    // Create command loader
    _cmdLoader = new PCommandLoader(this);


    ...


    addChild(_guiLoader);

    // Call on start
    onStart();
}
_cmdLoader = new PCommandLoader();
_cmdLoader.init(this);
Using /path/to/file in PHP on wamp -- goes to root of drive. How to make it go to document root?

Using /path/to/file in PHP on wamp -- goes to root of drive. How to make it go to document root?


By : Dinesh Khowal
Date : March 29 2020, 07:55 AM
like below fixes the issue Use the PHP system vars http://php.net/manual/en/reserved.variables.server.php
code :
$file = $_SERVER['DOCUMENT_ROOT'] . '/path/to/file.txt';
How to set default document root for if virtual document root doesnt exist?

How to set default document root for if virtual document root doesnt exist?


By : Andrey Nenkov
Date : March 29 2020, 07:55 AM
should help you out I have set up virtual document root using vhost_alias and it works good if directory of subdomain exists. but it throws 403 error if subdomain dir doesnt not exist. I want to set a default dir if sub domain doesn't exist. , Found solution
code :
RewriteEngine on
RewriteCond %{DOCUMENT_ROOT} !-d
RewriteRule (.*) http://app.domain.com/%{REQUEST_URI} [P,L]
SSLProxyEngine on
ProxyPassReverse / https://app.domain.com/
Related Posts Related Posts :
  • creating multiple rows based on record in an array - laravel
  • How to make an update in the Controller with a unique 'email' field in Laravel?
  • PHP: AdjacentElementsProduct - CodeFights https://app.codesignal.com/arcade/intro/level-2/
  • Codeigniter Check For Duplicate on Edit Function
  • PHP - Merge and Combine Array
  • Possible to combine regex for last word & number?
  • How to loop a REST API response?
  • How to load a lib with composer?
  • Query datetime field with only date in Laravel Eloquent
  • What is the right algorithm for digitally signing in C and veryfing in PHP?
  • Trouble sending image data to php file using ajax
  • PHP - preg_replace how to add an extra "]" and an extra "["
  • how to looping one data in laravel
  • Laravel Jobs (Queue) do not worked
  • PDO 'fetchAll' return rows with an extra array
  • How to Remove Duplicates Values from table
  • Post data and file together to Laravel API using Guzzle
  • How can I install imagick in current enabled PHP version?
  • Displaying japanese characters with PHP
  • SQLSTATE[HY000] [1045] Access denied for user 'mamim'@'localhost' (using password: YES)
  • How can I turn this string into a key value array?
  • PDO sql delete with multiple conditions
  • Call files, cancel call if webservice say so
  • PHP Download script error failed to load PDF document
  • Strange behavior reading DBF file in PHP using fread()
  • How to host or stream video uploaded in google drive using google drive api
  • How to get data from a string
  • adding wp store locator to woocommerce checkout
  • Can not silence a mysqli call
  • Refactor foreach with multilevel array
  • Catch exception in function, called inside try-catch. Doesn't works, why?
  • PHP is not removing files due to directory or files not being found
  • Laravel, how to sort and paginate of loop array
  • 3 tables many to many relationship
  • Show English characters instead of Arabic - WordPress
  • is there a way to reestructure file_get_contents output? php
  • mysqldump command is not executed just it is saved on a file
  • How to change the page URL with a button
  • Prevent duplicate entries in Log
  • Use variable inside another variable in a mail blade view
  • Login Redirect with router
  • Can you perform CRUD on CouchDB view?
  • Laravel, How to get array of session in controller and compare with model
  • Can't decode GET parameter
  • JSON decode foreach -> only delivery 1 row
  • Laravel/Ajax - Load more results without new results conflicting with the request
  • How to write in 2 input at the same time
  • Where to put Datatables JS logic in laravel using laravel mix?
  • product search by Category
  • Why silex don't resolve App in consructor?
  • append xml nodes inside another node in php
  • Events adding and loading problem in jQuery Full calendar using Sql Server and PHP
  • Detect 'false' with laravel @forelse and stop looping
  • php form not showing output?
  • How can i convert thai date to english using PHP?
  • How to handle duplicate entry for email error?
  • Get Count of Rows that is group by in sql
  • How to auto numbering/increment number of every column in table using PHP?
  • API Platform immutable property
  • Select from SQL single row and set to php array
  • shadow
    Privacy Policy - Terms - Contact Us © festivalmusicasacra.org