473,408 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Why is dirname(__FILE__) returning different results?

Hi,

On my php 4.4.4 environment, the call

$dir = dirname(__FILE__);

returns the full path of the directory. However, when I upload the
above code to my hosting company's server, the call returns ".". What
is the setting to force dirname(__FILE__) to alwasy return a full path
instead of a "."?

Thanks, - Dave

Jun 23 '07 #1
1 2369
fel
On Jun 23, 11:12 am, "laredotorn...@zipmail.com"
<laredotorn...@zipmail.comwrote:
Hi,

On my php 4.4.4 environment, the call

$dir = dirname(__FILE__);

returns the full path of the directory. However, when I upload the
above code to my hosting company's server, the call returns ".". What
is the setting to force dirname(__FILE__) to alwasy return a full path
instead of a "."?

Thanks, - Dave
realpath(dirname(__FILE__))

Jun 25 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Joca | last post by:
Hi. I have a problem with a dirname. I canīt read a file if i write this code: <?php $user = $_REQUEST; $filename = dirname(_FILE_).'/../revadv/$user'; $lines = file($filename); ?>
6
by: Tom | last post by:
I'm trying to dynamically adjust the path for one of my scripts using this: $script_path = str_replace( $_SERVER, "", dirname(realpath(__FILE__)) ) . DIRECTORY_SEPARATOR; The problem: the...
7
by: Dave Smithz | last post by:
Hi There, I have taken over someone else's PHP code and am quite new to PHP. I made some changes and have implemented them to a live environment fine so far. However, I now want to setup a...
7
by: Kamus of Kadizhar | last post by:
Thanks to everyone on this list. I now have a functioning piece of python code!! :-)) Now I'm trying to clean it up. I have the same (or similar) lines repeated several times: ...
2
by: Tim Williams | last post by:
I'm using Python 2.3.2 and tkFileDialog in a program I have. I'm trying to use this on Linux (RH 8.0) and Windows 2000. When I first upgraded from v2.2 to v2.3. I noticed that...
3
by: Jason | last post by:
Here's the code I'm using: #################################### import os, string for root, dirs, files in os.walk('/home/_Comedy'): for file in files: str = os.path.dirname(file) print root,...
2
by: Tom | last post by:
I've beat my head every way I can think of against this wall. Maybe someone here just knows the answer. I'm testing an upload class on my laptop WAMP server. When I run the test script,...
4
by: Giampaolo Rodola' | last post by:
I was reading os.readlink doc which says: readlink( path) Return a string representing the path to which the symbolic link points. The result may be either an absolute or relative pathname; if...
10
by: klenwell | last post by:
I apologize in advance for coming at this from this angle but... In PHP you have the __FILE__ constant which gives you the value of the absolute path of the file you're in (as opposed to the main...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.