Jump to content

[Answered] I Need Help Php Include Path Stuff


raffix2

Recommended Posts

OK, i'm trying to revamp my website for 2013 and I've started from scratch to redo everything.

 

I'm a self-thought web designer, I actually know nothing about it, but i'm good at getting the information I need and I am usually able to get things done on my own, but now, i'm having the worst time trying to figure this out.

 

My website(http://www.jfpoitras.com) is showing a bunch or error about include path:

 

Warning: include() [function.include]: Failed opening 'http://www.jfpoitras.com/sections/logo.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/raffix/public_html/index.php on line 14

 

&

 

Warning: include() [function.include]: http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home/raffix/public_html/index.php on line 14

 

It used to work well before when i used the PHP include command for repeating sections.

 

I think I screwed things over when i used the NetBeans feature in "Run configuration" to have a remote connection to my ftp and upload changed files. I used to do it manually with FileZilla, and I think I shouldn't change that in my process.

 

I think the key to this error is in the path shown here : (include_path='.:/usr/lib/php:/usr/local/lib/php') that path does not look right to me, it seems repeated with the extra local folder.

 

Can anyone help me?

Link to comment
Share on other sites

I think the key is this:

 

Warning: include() [function.include]: http:// wrapper is disabled in the server configuration by allow_url_include=0 in /home/raffix/public_html/index.php on line 14

 

might wanna fix that. Every error on your page starts with the wrapper being disabled.

  • Like 1
Link to comment
Share on other sites

how did I mange to disable the wrapper

It's likely set that way by default as a security measure, don't point to resources with http:// use $_SERVER['DOCUMENT_ROOT']."myfolder/myfile.php" or relative paths.

Link to comment
Share on other sites

Nope .. that didn't fix anything. I didn't think it would, as I said I was using include before the errors showed up. Ther errors showed after I let NetBeans upload files to my FTP.

 

Seriously, I don't understand what I need to do to fix this, I need some PHP expert and maybe someone that can actually change the PHP configuration on the server.

 

When i log to the Cpanel and go to the PHP configuration section, everything is static, I cannot change anything. It's probably better this way since I wouldn't know what to change to fix this.

 

I would like to add, that english is not my first language, and that I'm serious about explaining stuff in details to me, when you write stuff like "use $_SERVER['DOCUMENT_ROOT']." I don't understand what you are talking about, I need details, FAQ, i need it to be explained to me as if I was a 5 year old kid.

 

I think that the issue is located around this:

 

wrapper is disabled in the server configuration by allow_url_include=0

 

 

Where can I modify the allow_url_include parameter?

Link to comment
Share on other sites

You can not include a file via url for security reasons. Php settings are unchangeable by the user. Where is the file in correlation to where you are trying to include it?

 

$_SERVER['DOCUMENT_ROOT'] is a php function that will use the full path to your root directory /something/something/something/public_html/

Link to comment
Share on other sites

ok, i'm trying to make a very very very simple website

 

here's my index.php

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>www.JFPoitras.com</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
    <link href="/css/main.css" rel="stylesheet" type="text/css" media="screen, projection">
   </head>
   <body>
    <div id="wrapper">
	    <div id="header">
		    <div id="logo">
			    <?php include '/sections/logo.php'; ?>
		    </div> <!-- closing div #logo -->
		    <div id="title">
			    <?php include '/sections/title.php'; ?>
		    </div> <!-- closing div #title -->
	    </div> <!-- closing div #header -->
	    <div id="menu">
		    <?php include '/sections/menu.php'; ?>
	    </div> <!-- closing div #menu-->
	    <div id="content">
		    <h1>Hello World!</h1>
		    <p class="paragraph">
			    Welcome to my site!
		    </p>
		    <br>
		    <br>
		    <p class="paragraph">
			    Please come back later.
		    </p>
		    <br>
		    <br>
		    <br>
		    <br>
	    </div> <!-- closing div #content -->
	    <div id="widget">
	    </div> <!-- closing div #widget -->
    </div> <!-- closing div #wrapper -->
    <div id="footer">
	    <?php include '/sections/footer.php'; ?>
    </div> <!-- closing div #footer -->
   </body>
</html>

 

and here's what is in the /sections/logo.php

 

<a href="index.php" style="text-decoration: none"><img src="/images/jfhead.jpg" border="0" alt="www.JFPoitras.com"></a>

 

I have other little bits of HTML code within the php files i include (logo.php, title.php, menu.php, footer.php). And I do this so that these sections of my website, which will be repeated on every page can be easily changed lateron, by only updating that particular php file, not every page in my website.

 

I'm not trying to access, include, require from any other server, just using a simple time saving feature of PHP.

 

ok I tried that, here's my index.php now:

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>www.JFPoitras.com</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
    <link href="/css/main.css" rel="stylesheet" type="text/css" media="screen, projection">
   </head>
   <body>
    <div id="wrapper">
	    <div id="header">
		    <div id="logo">
			    <?php include $_SERVER['DOCUMENT_ROOT'].'/sections/logo.php'; ?>
		    </div> <!-- closing div #logo -->
		    <div id="title">
			    <?php include $_SERVER['DOCUMENT_ROOT'].'/sections/title.php'; ?>
		    </div> <!-- closing div #title -->
	    </div> <!-- closing div #header -->
	    <div id="menu">
		    <?php include $_SERVER['DOCUMENT_ROOT'].'/sections/menu.php'; ?>
	    </div> <!-- closing div #menu-->
	    <div id="content">
		    <h1>Hello World!</h1>
		    <p class="paragraph">
			    Welcome to my site!
		    </p>
		    <br>
		    <br>
		    <p class="paragraph">
			    Please come back later.
		    </p>
		    <br>
		    <br>
		    <br>
		    <br>
	    </div> <!-- closing div #content -->
	    <div id="widget">
	    </div> <!-- closing div #widget -->
    </div> <!-- closing div #wrapper -->
    <div id="footer">
	    <?php include $_SERVER['DOCUMENT_ROOT'].'/sections/footer.php'; ?>
    </div> <!-- closing div #footer -->
   </body>
</html>

 

And I still see all the errors.

 

It is my understanding that changing my code in index.php is not how to solve this because it was working well before.

 

Something to do with the php.ini file or the actual server config might make more sense. But i don't think i have access to those files and I don't see how I could have manage to disable the wrapper.

 

Btw, is the wrapper a PHP thing, or is it because i have a div with the id="wrapper" ?

 

ok i got it to work somehow, maybe i wasn't refreshing the folders in FileZilla

 

You can be sure I won't be using the Run feature on Netbeans anymore

 

thanks for the help

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...