Lost novice

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View


I have inherited a www service after someone, I have problems with PHP
parts. As I am complete novice. I will be very greatful for your help - I
did not managed to find an answer myself. My questions are trivial, I guess.

The service is now being moved to another server (PHP 4) and also I would
like to run it on my local WAMP (PHP 5) for tests.

1. There's a directory defined there called php_base, which is the root
directory of this service. All other file locations are definded as
$php_base/file. Unluckily php_base is absolute, so I need to change it
manually each time I want to use other server. Is there a way to make it
server-indpendent? I found that on my WAMP the default location is service
root, so I can simply use paths relative service root. However, I guess it
did not work this way on the old server, because the absolute path has been
specified. Could you show me a proper way of doing it?

2. Some php pages take a parameter, that is specified in the URL referencing
this page.
In the page body the parameter is referenced as $mypar. Unluckily for some
reason on my WAMP it is always seen as empty, no matter with what value I
open the page. I am helpless and could not find any indication in php

Many thanks for your help,


Re: Lost novice

Ewa wrote:
Quoted text here. Click to load it
- I
Quoted text here. Click to load it
guess it
has been
value I

1. as far as i can see, $php_base is a variable that must be defined
somewhere, but always has the same value. include, or better require,
some config file at the top of each script where you define your base
path, so you have to change only one setting every time the value

2. i think register_globals is set to off on your WAMP(check with
php_info), which means ?mypar=value is not automatically registered as
$mypar=value. register globals off is good, so don't change the
?mypar=value becomes $_GET['mypar']= value on your system. you could
use some editor that supports search/replace over many files to adapt
your code (i use proton for that - www.meybohm.de - but i don't know if
an english version is available).


Re: Lost novice

Many thanks for your advise.

Quoted text here. Click to load it
This is what I initially wanted to do, but then I realised that I need to
 give a path to the config file as well. At the moment I can only see
it as a relative path from each file (and subdirectory) of the service
(eg. ../../myconfig.txt).
I wonder is there any way (such as predefined variable) so as
the path looks the same no matter from which directory I include
the config?

Quoted text here. Click to load it
Thank you! This helps a lot.

Best regards,


Re: Lost novice

i use this:

require $_SERVER['DOCUMENT_ROOT'].'/config.php';

you just have to put your config file in the doc root.


Site Timeline