Re: include not working on Linux/Apache server



"Jerry Stuckle" <jstucklex@xxxxxxxxxxxxx> wrote in message news:yfednTWlj7kILFHanZ2dnUVZ_gWdnZ2d@xxxxxxxxxxxxxx
Aaron Gray wrote:
Hi,

For some reason incude does not seem to want to work. Its giving the error :-

Warning: include(http://www.***.org/skin/Test.php) [function.include]: failed to open stream: Permission denied in /var/www/***.org/html/skintest.php on line 9

PHP accesses the file system directly, not the web server. You're telling PHP to access /skin/Test.php from the root directory of your system, not your web server.

You need to tell PHP where the web root is first, then get your file, i.e.

include ($_SERVER['DOCUMENT_ROOT'] . '/skin/Test.php');

Great, thats it, thanks alot Jerry.

The following code works great now :-

$skinname = "Test";

include ($_SERVER['DOCUMENT_ROOT'] . "/skin/" . $skinname . ".php");

$skin = new $skinname;

$skin->show();

Many thanks again,

Aaron

.



Relevant Pages

  • Re: include not working on Linux/Apache server
    ... Other webapps like MediaWiki are running fine on the same server. ... You're telling PHP to access /skin/Test.php from the root directory of your system, not your web server. ...
    (comp.lang.php)
  • Re: include not working on Linux/Apache server
    ... PHP accesses the file system directly, not the web server. ... PHP to access /skin/Test.php from the root directory of your system, ... Using doublequoted strings and decent code colouring software, ...
    (comp.lang.php)
  • Re: include not working on Linux/Apache server
    ... PHP accesses the file system directly, not the web server. ... PHP to access /skin/Test.php from the root directory of your system, ... Using doublequoted strings and decent code colouring software, ...
    (comp.lang.php)
  • Re: Ruby performance woes
    ... Now here's my take on all this: PHP and JSP and what I inquired ... S-expressions used as a directly alternate expression of SGML or XML. ... By the way, I've never had access to a Web server that can run ASP, ...
    (comp.lang.lisp)
  • Re: PHP-Yes, HTML-No --- Why?
    ... Because the files, when downloaded, are called .php and have absolutely no php in them:) ... But the extension doesn't match the contents of the file. ... Surely a dynamic web server should appear exactly the same as a static one - all files that contain HTML when viewed should be called .html. ...
    (comp.lang.php)