There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
PHP help?.. erm...


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
BlackFrancis's Avatar
Computer Specs
Senior Member with 103 posts.
 
Join Date: Oct 2006
Experience: Intermediate
26-Sep-2007, 01:05 PM #1
PHP help?.. erm...
*runs and hides*

PHP is raping me of my confidence. I'm in dire need of help!

*note: I may talk constantly about this one, it's not my ONLY domain*

I tried an experiment... to test out the php include tag to make my work easier. To include a banner and nav-bar on EVERY page that I edit easily.

Page: www.blackholeproject.net/index.php
Script: www.blackholeproject.net/header.php

I did exactly what other tech-heads told me to. And in hindsight, I should have asked you guys first. You're damned geniuses (Firefox need a copy of the Oxford Dictionary).

Thanks in advance!

----
Donations

I've been using your wonderful services on and off for about a year now. And I feel guilty that I cannot afford a donation One day I shall - hang in there :P
namenotfound's Avatar
Computer Specs
Distinguished Member with 2,108 posts.
 
Join Date: Apr 2005
Location: New York
Experience: I know what I know, I am
26-Sep-2007, 01:41 PM #2
I'm getting a 404 error on this page

http://www.blackholeproject.net/header.php
dudeking's Avatar
Computer Specs
Senior Member with 345 posts.
 
Join Date: Feb 2007
Location: UK, Midlands
Experience: I'm Pro...
26-Sep-2007, 05:16 PM #3
dudeking's Avatar
Computer Specs
Senior Member with 345 posts.
 
Join Date: Feb 2007
Location: UK, Midlands
Experience: I'm Pro...
26-Sep-2007, 05:17 PM #4
PHP Code:
include('file to include'); 
thats the php include syntax if it helps for example

PHP Code:
include('/include/header.php'); 
namenotfound's Avatar
Computer Specs
Distinguished Member with 2,108 posts.
 
Join Date: Apr 2005
Location: New York
Experience: I know what I know, I am
26-Sep-2007, 05:53 PM #5
I prefer include_once this will make sure that if the code from a file has already been included, it will not be included again.
BlackFrancis's Avatar
Computer Specs
Senior Member with 103 posts.
 
Join Date: Oct 2006
Experience: Intermediate
27-Sep-2007, 09:24 PM #6
ooow.....
BlackFrancis's Avatar
Computer Specs
Senior Member with 103 posts.
 
Join Date: Oct 2006
Experience: Intermediate
27-Sep-2007, 09:29 PM #7
No.
Sorry. Still nothing.


Code:
<p><? include("head.php") ?>&nbsp;</p>
That what I used. I also tried with a directory / before it. Everything.
From the error messages I get - I've determined my method of tag is correct, but not the file location.
cpscdave's Avatar
Senior Member with 279 posts.
 
Join Date: Feb 2004
Experience: Intermediate
27-Sep-2007, 09:51 PM #8
yes your syntax is correct. What most likely is happening is your include_path isnt set right
You could try require_once thats the one I tend to use in this situation. But I doubt it'll make a difference.


Is head.php in the same directory as your main file?

What is your include_path set to?

The error should tell you what you include_path is.

For example

Fatal error: require_once() [function.require]: Failed opening required 'head.php' (include_path='.;C:\php\PEAR\pear;c:\htdocs\php5')
__________________
Its not a bug.... Its a feature!

Programming today is a race between software engineers striving to build bigger and better idiot-proof
programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
-Rick Cook

Spam a problem for you? http://spamooze.com
ivenms's Avatar
Computer Specs
Member with 36 posts.
 
Join Date: Sep 2007
Experience: WebMaster
28-Sep-2007, 06:24 AM #9
Change the CHMOD of your directory to 777

That will help you to change the error.
MMJ's Avatar
MMJ MMJ is offline
Distinguished Member with 3,208 posts.
 
Join Date: Oct 2006
28-Sep-2007, 12:53 PM #10
Quote:
Originally Posted by ivenms
Change the CHMOD of your directory to 777

That will help you to change the error.
No, CHMODing the folder to 777 is a bad practice and shouldn't make a difference. It might even give a Server 500 error.

@BF: Change include('/include/head.php') to include('./include/head.php'). I'm pretty sure that is the problem but like always I could be wrong.

Also you should use require, not include.
__________________
Guys, please, this is free tech support, act accordingly.

afk for a while
BlackFrancis's Avatar
Computer Specs
Senior Member with 103 posts.
 
Join Date: Oct 2006
Experience: Intermediate
28-Sep-2007, 02:31 PM #11
777 seems to be making some kind of difference to the reaction of the code.

As for path, simply "head.php"

Front Page
Code:
<html>
<head>
<title>Under Construction</title></head>

<body>
<div align="center">
  <p><strong><span class="style1">Temporarily unavailable</span></strong></p>
  <p><strong>We're redesigning The Black Hole Project. Enjoy the show! </strong></p>
</div>
<p>&nbsp;</p>
<p><? include("head.php") ?>&nbsp;</p>
</body>
</html>
=

Quote:
Warning: include() [function.include]: open_basedir restriction in effect. File(/include/head.php) is not within the allowed path(s): (/usr/share/pear/:/usr/local/apache2/:/misc/25/000/100/476/0/) in /misc/25/000/100/476/0/user/web/blackholeproject.net/index.php on line 11

Warning: include(/include/head.php) [function.include]: failed to open stream: Operation not permitted in /misc/25/000/100/476/0/user/web/blackholeproject.net/index.php on line 11

Warning: include() [function.include]: open_basedir restriction in effect. File(/include/head.php) is not within the allowed path(s): (/usr/share/pear/:/usr/local/apache2/:/misc/25/000/100/476/0/) in /misc/25/000/100/476/0/user/web/blackholeproject.net/index.php on line 11

Warning: include(/include/head.php) [function.include]: failed to open stream: Operation not permitted in /misc/25/000/100/476/0/user/web/blackholeproject.net/index.php on line 11

Warning: include() [function.include]: Failed opening '/include/head.php' for inclusion (include_path='.:/usr/share/pear') in /misc/25/000/100/476/0/user/web/blackholeproject.net/index.php on line 11
And the makeup of head.php:
Code:
<?php booooong ?>
There's something I'm doing wrong here... and I intend to work it out somehow.
MMJ's Avatar
MMJ MMJ is offline
Distinguished Member with 3,208 posts.
 
Join Date: Oct 2006
29-Sep-2007, 11:29 AM #12
Grr... Did you read my post?

Change include('/include/head.php') to include('./include/head.php')
BlackFrancis's Avatar
Computer Specs
Senior Member with 103 posts.
 
Join Date: Oct 2006
Experience: Intermediate
29-Sep-2007, 03:10 PM #13
Yeah, don't worry. I read your posts, made the changes, and nothing happened.
MMJ's Avatar
MMJ MMJ is offline
Distinguished Member with 3,208 posts.
 
Join Date: Oct 2006
29-Sep-2007, 03:33 PM #14
Quote:
Originally Posted by BlackFrancis
Yeah, don't worry. I read your posts, made the changes, and nothing happened.
Did you change it back? Or are the changes I advised still in effect?
BlackFrancis's Avatar
Computer Specs
Senior Member with 103 posts.
 
Join Date: Oct 2006
Experience: Intermediate
29-Sep-2007, 09:01 PM #15
Gone. Changed back.
Back to what I quoted 3 posts back.
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 10:37 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.