Programming Tools
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingProgramming Tools

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old November 28th, 2003, 10:38 AM
dotcomma dotcomma is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: New Zealand
Posts: 20 dotcomma User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Errors with define()

Hi all,

In an include file, I have defined directories like this:
PHP Code:
 define('DIR_SITE'HTTP_SERVER 'myown/');
define('DIR_INCLUDES'DIR_SITE 'includes/'); 

This is so I can access (include) the same files from within different files that are stored in different directories and levels.
Problem is, I get errors like

Failed opening 'http://pouggey/myown/includes/tplstuff.php' for inclusion (include_path='.;F:\php\pear\') in f:\www\mysite\styles\edit\tpl001.php on line 93

Odd thing is, 'http://pouggey/myown/includes/tplstuff.php' is the exact location where the file is to be found!
So it must have something to do with Pear?
Thing is, if I just type in the path to the include file, it works...
Anybody got any ideas?
Thanks,

Toine

Reply With Quote
  #2  
Old November 28th, 2003, 01:28 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
So you're script (with the defines) is being called from within 'http://pouggey/myown'?


you may want to try this:
define('DIR_SITE', HTTP_SERVER . '/myown/');
define('DIR_INCLUDES', DIR_SITE . '/includes/');

notice the first forward slash, which relates to root...
you may have to use /myown/includes/ (not sure your exact directory layout)


See if you get the same error...

Reply With Quote
  #3  
Old November 28th, 2003, 09:09 PM
dotcomma dotcomma is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: New Zealand
Posts: 20 dotcomma User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Yes, that gives me the same error (except I get double forward slashes now).
Here are the first few lines of definitions.php:
PHP Code:
 define('HTTP_SERVER''http://pouggey/');
define('DIR_SITE'HTTP_SERVER '/myown/');
define('DIR_INCLUDES'DIR_SITE '/includes/');
define('DIR_STYLES'DIR_SITE '/styles');
define('DIR_CSS'DIR_STYLES '/stylesheets/'); 

Then I call the includes like this:
PHP Code:
<?php
require('includes/definitions.php');
require(
DIR_INCLUDES 'db.php');
..
etc...
?>

So now my error message is:
Failed opening required 'http://pouggey//myown//includes/db.php

It works when I use it like this:
PHP Code:
<link href="' . DIR_CSS . 'style001.css" type="text/css" rel="stylesheet"

(note the " ' . " before the "DIR_CSS".)

How can I get around this please?

~*~*~*~*~

UPDATE:
I have uploaded some of the files to my Web Host, just to see what happens on a Linux server (I currently run WinNT at home).
There I get this error message:
Quote:
Warning: main(): stream does not support seeking in /home/path/to/myown/step1.php on line 3

Line 3:--> require(DIR_INCLUDES . 'db.php');

Reply With Quote
  #4  
Old December 14th, 2003, 04:44 PM
Mike_r Mike_r is offline
ExoCrew
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 68 Mike_r User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
It looks like the a bug which was in PHP.

us @include instead of include and see what happens.

http://bugs.php.net/bug.php?id=24053

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingProgramming Tools > Errors with define()


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT