By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,516 Members | 1,178 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,516 IT Pros & Developers. It's quick & easy.

Lost novice

P: n/a
Ewa
Hello

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.
http://localhost/mypage.php?mypar=value
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
manual.

Many thanks for your help,

Ewa

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

Ewa wrote:
Hello

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.
http://localhost/mypage.php?mypar=value
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
manual.

Many thanks for your help,

Ewa

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
changes.

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
setting.
?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).

micha

Jul 17 '05 #2

P: n/a
i use this:

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

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

micha

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.