473,785 Members | 2,924 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP_SELF incorrect on WIMP shared host

My host is running WIMP and has set up shared configuration.

Lets say the address is

http://kevin.host.com

Now, the actual directory is c:\inetpub\wwwr oot\kevin

If I check PHP_SELF from a test file, it reports it as /kevin/test.php
instead of /test.php leading me to believe that there is something
amuck with his setup.

4.3.4 is the version of PHP he is running. Needless to say, this plays
havock with any script that uses the PHP_SELF and I have worked around
it by hard coding paths that I shouldn't need to.

The host and I are both scratching our heads at this. This is their
first trip in the PHP world, and I have never seen this (worked fine on
apache) so I am at a loss.

Can someone point me to an answer?

-Kevin

Jul 17 '05 #1
5 1805
If you read the manual at http://uk2.php.net/reserved.variables you will see
that PHP_SELF returns a value which is relative to the document root. If you
document root is c:\inetpub\wwwr oot then running a file from
c:\inetpub\wwwr oot\kevin\test. php will report "kevin/test.php". THIS IS
CORRECT.

If you want to strip off the leading "kevin/" then check out
http://uk2.php.net/manual/en/function.basename.php.

Hope this helps.

--
Tony Marston

http://www.tonymarston.net

"Kevin Haryett" <Ke***********@ gmail.com> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.com...
My host is running WIMP and has set up shared configuration.

Lets say the address is

http://kevin.host.com

Now, the actual directory is c:\inetpub\wwwr oot\kevin

If I check PHP_SELF from a test file, it reports it as /kevin/test.php
instead of /test.php leading me to believe that there is something
amuck with his setup.

4.3.4 is the version of PHP he is running. Needless to say, this plays
havock with any script that uses the PHP_SELF and I have worked around
it by hard coding paths that I shouldn't need to.

The host and I are both scratching our heads at this. This is their
first trip in the PHP world, and I have never seen this (worked fine on
apache) so I am at a loss.

Can someone point me to an answer?

-Kevin

Jul 17 '05 #2
Kevin Haryett wrote:
My host is running WIMP and has set up shared configuration.

Lets say the address is

http://kevin.host.com

Now, the actual directory is c:\inetpub\wwwr oot\kevin

If I check PHP_SELF from a test file, it reports it as /kevin/test.php
instead of /test.php leading me to believe that there is something
amuck with his setup.


As an addition to Tony's explanation: Maybe you look after
$_SERVER['SCRIPT_NAME'] rather than $_SERVER['PHP_SELF']. Have a look at
phpinfo() to see what values the various environmental variables return, and
decide which one suits you.

HTH
Markus
Jul 17 '05 #3
If this is going to be a shared host for many users, what are my
options? There are going to be many wordpress setups, and altering code
is not an option.

Would setting thes up as sites in IIS (thus allowing a different
document root) be the only option?

Jul 17 '05 #4
Kevin Haryett wrote:
If this is going to be a shared host for many users, what are my
options? There are going to be many wordpress setups, and altering
code is not an option.

Would setting thes up as sites in IIS (thus allowing a different
document root) be the only option?


Now I think I understand what you mean - your own "root" directory is not
the actual root directory. So what I would do is define a variable for the
directory I want to refer to:

$my_root_rel = "/kevin";
$my_root_abs = $_SERVER['DOCUMENT_ROOT'].$my_root_rel;

Then use those to build all your paths:
In HTML:
<img src="<?php echo $my_root_rel; ?>/images/my_image.gif">
In PHP:
getimagesize($m y_root_abs."/images/my_image.gif");

HTH
Markus
Jul 17 '05 #5
That would not be an option for me to run Wordpress as it makes use of
the PHP_SELF. It will also not work for any of the other users or
scripts.

Jul 17 '05 #6

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

Similar topics

13
6116
by: deko | last post by:
I'm trying to identify which named anchor is currently being viewed on a page. Although the address bar of my browser shows #whatever appended to the end of the url, I can't seem to find it in a variable. My efforts below return no value for ANYTHING except . Am I missing something? $url = parse_url($_SERVER); $scheme = ($url);
3
2527
by: John Hanauer | last post by:
I'm getting my own SSL certificate soon because it is the right thing to do, but until then I have this shopping cart on an ISP that gives me free shared SSL. The cart breaks in HTTPS because of $PHP_SELF and the cart's tech support blames my ISP. I'm wondering if this is true. So, my site, let's call it mydomain.com would normally access at: http://mydomain.com/
10
15205
by: tHatDudeUK | last post by:
My form action code to submit values to itself have stopped working using the code form action = <?=$_SERVER?> This code used to work My web host recently told me they enabled phpsuexec option in apache which apparently needs me to CHMOD my PHP page to 750 and the directory to 755. (I don't know what this means but know how to CHMOD files). I have CHMODed the
5
2835
by: Maja | last post by:
here's situation: i have installed php 5 and apache 2.0. i can call my page with: localhost\\subdir\page.php inside my page i use links like this:
12
4465
by: Don | last post by:
What's the PHP equivalent for the following? if(window.location == "http:/site.com/page1.html") { } else { }
1
14400
by: Michelle Hillard | last post by:
Hi guys, would appreciate if you can shed some light on this. Sorry to be a pain, can you tell me what is wrong with the following: for /F %%i in ('dir /b /on c:\bcp\pc*.txt') do bcp Inventory..pc in %%i -fc:\bcp\bcp.fmt -T -S CHICKYy where CHICKYy is the server bcp.fmt
7
1898
by: zek2005 | last post by:
Hi!!! I need to retrieve the information of a database in 2 steps. First, depending on the number of a branch, I have to show in a combo the commercial campaigns available for that branch. Then when the user select one campaign I need to chow the customers of that campaign. I have two errors (http://www.historiadelpais.com.ar/bp/acciones_vigentes.php).
10
5267
by: Jim Carlock | last post by:
Looking for a way to extract the path from the pfqpn (partially full qualified path name). $sThisServer = $_SERVER; // returns either aquaticcreationsnc.com or www.aquaticcreationsnc.com $sThisServer = $_SERVER; // returns aquaticcreationsnc.com whether or not the end-user typed // in the preceding www.
5
2845
by: Tom | last post by:
I have a function that restricts access to a page to logged in users. When a user who isn't logged in goes to the page, it will dynamically generate a login form. I'm trying to use it in conjunction with the free shared SSL certificate offered by my host. To use SSL, you would change a URL like this http://mydomain.com/page.php
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10315
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10085
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9947
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7494
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4045
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.