473,396 Members | 2,154 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,396 software developers and data experts.

getting base directory

I want a function that gives me the base directory of a script.

So when given the script file '/var/www/test.org/html/test/index.php' from
$_SERVER['SCRIPT_FILENAME'] it returns '/var/www/test.org/html/test/'.

I am wondering the neatest way to do this ?

I cannot find a reverse string search function.

Many thanks in advance,

Aaron
Apr 2 '08 #1
6 1727
"Aaron Gray" <an********@gmail.comwrote in message
news:65*************@mid.individual.net...
I want a function that gives me the base directory of a script.

So when given the script file '/var/www/test.org/html/test/index.php' from
$_SERVER['SCRIPT_FILENAME'] it returns '/var/www/test.org/html/test/'.

I am wondering the neatest way to do this ?

I cannot find a reverse string search function.

Many thanks in advance,

Aaron

basename

Apr 2 '08 #2
"Steve Foley" <st*********@att.DELETE.netwrote in message
news:d5OIj.14899$oE1.7400@trndny09...
"Aaron Gray" <an********@gmail.comwrote in message
news:65*************@mid.individual.net...
>I want a function that gives me the base directory of a script.

So when given the script file '/var/www/test.org/html/test/index.php'
from
$_SERVER['SCRIPT_FILENAME'] it returns '/var/www/test.org/html/test/'.

I am wondering the neatest way to do this ?

I cannot find a reverse string search function.

Many thanks in advance,

Aaron


basename
That was quick :)

Thanks,

Aaron
Apr 2 '08 #3
"Steve Foley" <st*********@att.DELETE.netwrote in message
news:d5OIj.14899$oE1.7400@trndny09...
"Aaron Gray" <an********@gmail.comwrote in message
news:65*************@mid.individual.net...
>I want a function that gives me the base directory of a script.

So when given the script file '/var/www/test.org/html/test/index.php'
from
$_SERVER['SCRIPT_FILENAME'] it returns '/var/www/test.org/html/test/'.

I am wondering the neatest way to do this ?

I cannot find a reverse string search function.

Many thanks in advance,

Aaron


basename
You mean dirname not basename !:)

Aaron
Apr 2 '08 #4
<comp.lang.php>
<Aaron Gray>
<Wed, 2 Apr 2008 17:04:44 +0100>
<65*************@mid.individual.net>
basename

You mean dirname not basename !:)
$batman=pathinfo($doc,PATHINFO_DIRNAME);

Havent actually tried it myself - its just a snippet of code i have .
--
www.krustov.co.uk
Apr 2 '08 #5
"Krustov" <me@privacy.netwrote in message
news:MP************************@news.newsreader.co m...
<comp.lang.php>
<Aaron Gray>
<Wed, 2 Apr 2008 17:04:44 +0100>
<65*************@mid.individual.net>
basename

You mean dirname not basename !:)

$batman=pathinfo($doc,PATHINFO_DIRNAME);

Havent actually tried it myself - its just a snippet of code i have .
It works I have used it in my utils.

Aaron
Apr 2 '08 #6
"Aaron Gray" <an********@gmail.comwrote in message
news:65*************@mid.individual.net...
>
You mean dirname not basename !:)

Aaron
Yup.

Apr 2 '08 #7

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

Similar topics

6
by: john_williams_800 | last post by:
Hi; I am writing an html page that will live on one server in an ms windows network, but access pictures from a directory on another ms windows server in the network. I know in html the...
3
by: PJ6 | last post by:
Is it possible to get the absolute path (i.e. C:\inetpub\wwwroot) of the IIS root directory? And yes, I do need to get the actual, absolute path, because the Crystal Reports XI web viewer does -...
0
by: ruju00 | last post by:
I am getting an error in Login() method of the following class FtpConnection public class FtpConnection { public class FtpException : Exception { public FtpException(string message) :...
8
by: Brett Romero | last post by:
I have this situation: myEXE <needs< DerivedClass <which needs< BaseClass Meaning, myEXE is using a type defined in DerivedClass, which inherits from BaseClass. I include a reference to...
8
by: lawrence k | last post by:
I've installed Apache 1.3.36 on my Redhat EL 3 machine. Now I'm trying to install PHP 5.1.4. I can not get the ./configure command to work. I keep getting this error: configure: error: Invalid...
2
by: Markus | last post by:
Hello Is it possible to determine the PHP path to the FTP base directory? ftp_pwd($conn_id) returns '/', while I need something like '/data/users/domain.com/'. I used a construct such as: ...
13
by: lawpoop | last post by:
Hello all - I have a two part question. First of all, I have a website under /home/user/www/. The index.php and all the other website pages are under /home/user/www/. For functions that are...
2
by: Kakkanattu | last post by:
Hi, In desktop application, we use different ways to get the current execution directory. I. AppDomain.CurrentDomain.BaseDirectory II. Environment.CurrentDirectory...
11
by: Sachin Garg | last post by:
I need to build two executables from my code, one having all the code (and thus application features) and other not having it all. How to best manage the code that shouldn't go in one of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.