PHP help please


#1

k. I having a huge problem and I never had this before. I did everything just rite and I can’t fix it. here’s the problem:

Warning: include(.html) [function.include]: failed to open stream: No such file or directory in /home/.ornek/conceptourneys/conceptourneys/index.php on line 167

Warning: include() [function.include]: Failed opening ‘.html’ for inclusion (include_path=’.:/usr/local/php5/lib/php’) in /home/.ornek/conceptourneys/conceptourneys/index.php on line 167

the site is conceptourneys.com

Thanks

Matta


#2

First of all, the word is right.

The error message is stating that the file you are trying to include does not exist. I recommend that you copy and paste the include() line from your code here so that we can see what the problem is.


Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#3

From what you rote, watever is set to point at:

/home/.ornek/conceptourneys/conceptourneys/index.php

should probably point at:

/home/.ornek/conceptourneys/conceptourneys[color=#CC0000].com[/color]/index.php

Defnitly somhtin rong heer.

You are welcome to a refund.-Michael;Comparing ‘DH of today’ with ‘DH of old’ does not serve much purpose.-Dallas


#4

Man, we can be buttheads here. Helpful, but buttheads.


#5

Some buttheads, some good humored; it’s a delicate balance.

You are welcome to a refund.-Michael;Comparing ‘DH of today’ with ‘DH of old’ does not serve much purpose.-Dallas


#6
<?php include ("$page.html"); ?>

my index.php is in my root/conceptourneys
my .html page are also in there

when I insert the code from my cutephp news it works fine, but not that command.

Matta

P.S. buttheads can be useful though


#7

The Include states a string and combine 2 strings together and the second string is lacking the $ symbol.
I don’t think that was your intentions.
Try something like

<?php include ("$page" . '.html'); ?>

This will append .html to the string page.
Silk

My website


#8

Doesn’t work. Same problem.


#9

You can leave .ornek/ out of the path like this: /home/conceptourneys/conceptourneys

And you did verify that the domain directory is conceptourneys and not conceptourneys.com? It will default to the full domain name, unless you changed it when you added the domain.

The default format would be /home/username/domainname.com.

Anyway… $page is not being assigned a value, as shown in this error:

Warning: include(.html) [function.include]: failed to open stream

I’d add some code to check that $page is being set, and if it’s not, assign a default value.

Something like:

if(!isset($page)) { $page = 'whatever'; }If $page is pulling from a GET variable, then you’ll need to change it to $_GET[‘page’] instead of $page.

If that’s not the problem, then you should post the code where $page is getting assigned a value.


:stuck_out_tongue: Save up to $96 at Dreamhost with ALMOST97 promo code (I get $1).
Or save $97 with THEFULL97.


#10

this is just the same you give as solution.
Php searches for variables in strings with double quotes, so “$page.html” is correct resolved to test.html if $page = “test”

Did you check whether the $page variable is correctly filled up?


slauson.dreamhost.com rocks! (so does my site :))
link me


#11

I recommend a completely different approach. Let me assume that the page you want to include is here:

/home/.ornek/conceptourneys/conceptourneys/page_to_include.htmlInstead of using a relative path, try doing it this way:

$page = "page_to_include.html"; include($_SERVER['DOCUMENT_ROOT']."/conceptourneys/$page");Personally, I prefer to put all my “includes” in a separate folder. All of my include links look like this:

include($_SERVER['DOCUMENT_ROOT']."/includes/whatever.php");--------
Simon Jessey | Keystone Websites
Save $97 on yearly plans with promo code [color=#CC0000]SCJESSEY97[/color]


#12

k still not working. do I need to install anything on my dreamhost server or what? this is weird. I know my php and if I don’t than I have some resources, but for some reason nothing is working. Any ideas anyone?

Matta


#13

[quote]Any ideas

[/quote]

Edit: 1. Sorry, that was overly obnoxious of me. I reacted to “nothing is working.” Obviously, some things are working. Maybe if you described more of your situation, that would help. I still wonder about directory structure, missing files, permissions, etc.

  1. Ask smart questions ™

You are welcome to a refund.-Michael;Comparing ‘DH of today’ with ‘DH of old’ does not serve much purpose.-Dallas


#14

Did you read my reply?

It’s not going to work until you assign a value to $page. The error says you’re trying to include(.html). See the whole bunch of nothing where $page should be? :wink:


:stuck_out_tongue: Save up to $96 at Dreamhost with ALMOST97 promo code (I get $1).
Or save $97 with THEFULL97.


#15

I see you’re using URLs like this: http://www.conceptourneys.com/index.php?page=specialthanks

Replace $page in your code with $_GET[‘page’]. What you’re trying to do will only work with register_globals on. With PHP5, it’s off for security reasons.

I would actually recommend a different approach. You shouldn’t blindly use user-supplied input. You might start by writing a switch statement (or a series of if-elseif statements) with the values you expect to see, match them against the input you receive as query string arguments, and drop everything else.


If you want useful replies, ask smart questions.


#16

I will be willing to make a account for some to access it and try there self. Because I tried all the commands you guys are giving me and for some reason they aren’t working. If no one replies within the next hour than I’ll delete the domain and try it again from there. Thanks for your help you guys

Matta


#17

well I deleted the whole domain and started over. I reuploaded everything and now the site isn’t showing for some reason. I get this:

Site Temporarily Unavailable
We apologize for the inconvenience. Please contact the webmaster/ tech support immediately to have them rectify this.

error id: “bad_httpd_conf”

Probably cause I have to wait a bit. If not than someone tell me how to fix it. Hopefully this will fix the php problem. If not than I don’t know what to do than

thanks

Matta

Websites in Design Process
Matta Productions - (10% done) - http://www.mattaproductions.com

Young Fyre - (50% done)
http://www.youngfyre.com

ConCepTourneys (well humm…having issues but if it wren’t than 90% done)
http://www.conceptourneys.com


#18

Sometimes you can wait it out. Sometimes, just re-saving your domain settings does the trick. When all else fails, just report the error to support and they’ll fix it.

The problem is definitely that $page has no value assigned to it. Without seeing more of the code where $page is defined, it’s being assumed that the only way it’s defined is by variable passed in the URL.

Like I said in my first reply, if you’re pulling from a URL, you need to use $_GET[‘page’] instead of page. If there are several instances of it and you don’t want to look through all of the code and replace it, just add this line to the top:

$page = $_GET[‘page’];

Then, $page will work.

Since the rest of the page, and your site in general, were working, I don’t think deleting/re-installing will change anything, as PHP is still the same.

I just went to the site and see it’s back up… sorta. The error shows it running under another user and you’ve gone with the default .com directory name – just in case you need to change any hard coded references to the path.

include(.html) is still there, showing that $page isn’t being defined.

I’m also only getting the bad_http_conf error on the www version, while the site is partially loading for me without the www… but I guess that could be a cache-thing.


:stuck_out_tongue: Save up to $96 at Dreamhost with ALMOST97 promo code (I get $1).
Or save $97 with THEFULL97.


#19

I inserted the code and still nothing. Add me on aim at matthammond21 or msn matthammond21@hotmail.com

Matta


#20

I don’t have any messenger clients installed, but here’s a quick easy test page you could make:

Let’s call it test.php

<?php $page = $_GET['page']; echo '$page is ' . $page; ?>Save that as test.php in your web directory.

When you go to conceptourneys.com/test.php, it should print out:

$page is

Now, go to conceptourneys.com/test.php?page=working!

This time it should print out:

$page is working!

At this point, we know that there is no problem grabbing variables from the URL. Of course, this only matters if that’s how your script is defining $page.

Now, put a file in your web directory called include.php that contains the text, “Include worked.”

Replace the original contents of test.php with this:

<?php $page = $_GET['page']; if ($page == 'include.php') { include("{$_SERVER['DOCUMENT_ROOT']}/$page"); } else { echo 'Include failed.'; } ?> Now, go to conceptourneys.com/test.php?page=include.php

That will print out whether or not the include failed or succeeded.

If both of those tests work, PHP is doing its job (I tested them to make sure they worked).

Is there a place in your script where $page is defined, or is it only in the URL?

I’d search the code for every mention of $page. If there’s not a line where it’s defined ($page = ‘something’;), and it’s only being grabbed from URLs, then you can do two things:

  1. Put this at the top of every page where $page will be called from (or in one file that’s always included):

$page = $_GET[‘page’];

  1. Do a search & replace for $page, replacing it with $_GET[‘page’]

If there’s a config file, or something that you know is included with every single page, you could add the code in step 1 there.

If it still doesn’t work… it should at least put out a different error. If “include(.html)” changes to something like “include(’/the/path/the_file.html’)” – then you know $page is now being defined, so you would then just need to make sure the file is where it’s trying to include it from.

It would probably be a good idea to post the part of the code where $page is being defined, or if it’s not defined, at least the first section of code where it’s mentioned.

Also, is there a newer version of the script your using? If so, I’d upgrade and see if they’ve already corrected the problem. I can’t picture releasing a script that counted on register_globals being on.


:stuck_out_tongue: Save up to $96 at Dreamhost with ALMOST97 promo code (I get $1).
Or save $97 with THEFULL97.