Help with .inc files!!

Reply

Join Date: Feb 2008
Posts: 2
Reputation: Beks is an unknown quantity at this point 
Solved Threads: 0
Beks Beks is offline Offline
Newbie Poster

Help with .inc files!!

 
0
  #1
Feb 14th, 2008
Hi All,

Please bare with me as I'm new to this forum and to web design. I was asked by my boss to design adn upload a new website via ftp, which I can do. I realised this morning that it is not as simple as just that! Basically, here's what I need help with..

When I access our URL this is what I get

Warning: include(includes/globals.php.inc) [function.include]: failed to open stream: No such file or directory in /home/planlond/public_html/index.php on line 5

Warning: include() [function.include]: Failed opening 'includes/globals.php.inc' for inclusion (include_path='.:/usr/lib/php') in /home/planlond/public_html/index.php on line 5

Warning: include(includes/functions.php) [function.include]: failed to open stream: No such file or directory in /home/planlond/public_html/index.php on line 6

Warning: include() [function.include]: Failed opening 'includes/functions.php' for inclusion (include_path='.:/usr/lib/php') in /home/planlond/public_html/index.php on line 6

Warning: include(lang/.php) [function.include]: failed to open stream: No such file or directory in /home/planlond/public_html/index.php on line 7

Warning: include() [function.include]: Failed opening 'lang/.php' for inclusion (include_path='.:/usr/lib/php') in /home/planlond/public_html/index.php on line 7

Warning: include(themes//config.php.inc) [function.include]: failed to open stream: No such file or directory in /home/planlond/public_html/index.php on line 8

Warning: include() [function.include]: Failed opening 'themes//config.php.inc' for inclusion (include_path='.:/usr/lib/php') in /home/planlond/public_html/index.php on line 8

Warning: include(themes//homepage.php) [function.include]: failed to open stream: No such file or directory in /home/planlond/public_html/index.php on line 16

Warning: include() [function.include]: Failed opening 'themes//homepage.php' for inclusion (include_path='.:/usr/lib/php') in /home/planlond/public_html/index.php on line 16


I know that it's because I havn't done something with the .inc file, but to be honest I'm, a bit clueless in regard to all this....a simple design and upload it is not!! I'm using Dreamweaver.

HELP!!

Thank you for your time!

Beks XX
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,761
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: Help with .inc files!!

 
0
  #2
Feb 14th, 2008
Check where include directory is. If you are executing a script in, say for example, www/site/test/1.php and you are trying to include a file eg. functions.php, which is in www/site/include folder, you should give, include ("../include/functions.php"); because that's where the file is. If you give, include ("include/functions.php"); it wont be able to find it, hence, you get this error.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 2
Reputation: Beks is an unknown quantity at this point 
Solved Threads: 0
Beks Beks is offline Offline
Newbie Poster

Re: Help with .inc files!!

 
0
  #3
Feb 14th, 2008
That's great, thankyou (although still having great difficulty!!) Sorry to be a pain, but is there a quick simple way I can display a static page on the URL whilst I figure this out? My boss isn't too pleased.. oops

Thankyou!
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 3,761
Reputation: nav33n is a jewel in the rough nav33n is a jewel in the rough nav33n is a jewel in the rough 
Solved Threads: 332
Moderator
Featured Poster
nav33n's Avatar
nav33n nav33n is offline Offline
Senior Poster

Re: Help with .inc files!!

 
0
  #4
Feb 14th, 2008
eg.
  1. if(1!=2){
  2. include "error.php";
  3. } else {
  4. include "includes/function.php";
  5. include "includes/anotherpage.php";
  6. ........
  7. }
The basic idea is, if(1!=2) will always return true. So, it will include error.php (where you can have a message saying the site is down or something). Make required changes in the path of all other include files and then remove the condition 1!=2.
Ignorance is definitely not bliss!

*PM asking for help will be ignored*
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 57
Reputation: Walkere is an unknown quantity at this point 
Solved Threads: 5
Walkere Walkere is offline Offline
Junior Poster in Training

Re: Help with .inc files!!

 
0
  #5
Feb 14th, 2008
Originally Posted by Beks View Post
That's great, thankyou (although still having great difficulty!!) Sorry to be a pain, but is there a quick simple way I can display a static page on the URL whilst I figure this out? My boss isn't too pleased.. oops

Thankyou!
You can dynamically check to see whether or not the file was included, and then automatically display the regular page or some other content.

First thing you'll want to do (at least when you're not testing it) is turn off error-reporting.

This will prevent the errors from showing up and telling your users that something is broke. You can do this by adding this line to the top of the file.

  1. ini_set("display_errors", "Off");

Then, you can add a conditional statement to check if the file was included or not. If include() successfully finds the file, it returns "True." Otherwise, it will return false.

Seeing as you're including a lot of files, I'd create an error flag, set that flag to "True" if any of the files aren't included, and then at the end of the includes check whether or not the flag was set. Like this...

  1. $error = false;
  2. if ( !include("exampleFile.php")) {
  3. // There was an error, exampleFile.php wasn't found
  4. $error = true; }
  5.  
  6. if ( !include("exampleFile2.php")) {
  7. // There was an error, exampleFile2.php wasn't found
  8. $error = true; }
  9.  
  10. if ($error == true) {
  11. // There was an error
  12. // Include your alternate info here
  13. // Or use header("Location: http://domain.com/static-page.html"); to redirect
  14. } else {
  15. // There was on error. Execute the regular page here.
  16. }

Or... you could just rename the file you're working with to something else. Then create a new file with the old name (and no includes). Once you've fixed the original file, change the names back.

Good luck,
- Walkere
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 754 | Replies: 4
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC