943,910 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 944
  • PHP RSS
Feb 14th, 2008
0

Help with .inc files!!

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Beks is offline Offline
2 posts
since Feb 2008
Feb 14th, 2008
0

Re: Help with .inc files!!

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.
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Feb 14th, 2008
0

Re: Help with .inc files!!

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!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Beks is offline Offline
2 posts
since Feb 2008
Feb 14th, 2008
0

Re: Help with .inc files!!

eg.
php Syntax (Toggle Plain Text)
  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.
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Feb 14th, 2008
0

Re: Help with .inc files!!

Click to Expand / Collapse  Quote originally posted by Beks ...
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.

php Syntax (Toggle Plain Text)
  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...

php Syntax (Toggle Plain Text)
  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
Reputation Points: 29
Solved Threads: 5
Junior Poster in Training
Walkere is offline Offline
57 posts
since Jan 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: How to Make search page and code
Next Thread in PHP Forum Timeline: Multi-Lingual Site





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC