This is a discussion on "PHP problem in Apache/PHP/MySQL" within the PHP Forum section. This forum, and the thread "PHP problem in Apache/PHP/MySQL are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
PHP problem in Apache/PHP/MySQL
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
I have just set up a local Apache/PHP/MySQL setup on my local PC to act as a tesing and development site for a remote web. In order to set a PHP variable from one page to the next I place the PHP variable in the URL to select the page content from a MySQL data base. Example:
http://www.mysite.co.uk/pages/main.php?page=0008 This works fine in the remote live site but the variables do not get passed on in my local test server. Everything else works just fine (Apache/PHP/MySQL), just this PHP variable fails to transfer. The setup is newly installed and copies closely the versions on the hosted site: WinXP/Apache 1.3.34/PHP 4.4.2/MySQL4.0.26. Is there a setting to enable this in PHP or does anyone have an idea what is wrong? Hope I have posted enough information. Thanks JohnI |
|
|
|
|||
|
Re: PHP problem in Apache/PHP/MySQL
Have I found the answer elsewhere in the Forum that "register_globals" needs to be "on" to make this happen? But you specialists consider this an insecure way of passing variables? Correct? Thanks John I
|
|
|||
|
Re: PHP problem in Apache/PHP/MySQL
im no pro at installing such systems, so my advice here will most likely be wrong. but will it matter? like you say, its only for test purposes, and if its going up to a server which has been set up properly, would it be such a problem?
|
|
|||
|
Re: PHP problem in Apache/PHP/MySQL
It's certainly possible that a different setting of register_globals is leading to the different behaviour. With version 4.4.2 of PHP, you should be using the passed on variable in the new script from the incoming variable $_GET[page] or $_REQUEST[page] which will work for any setting or register_globals. If you use $page then it will only work if you have register_globals set to on.
Security? It's possible to write perfectly secure code whatever register_globals is set to. However, with it set off it's very easy to flawed code too which is why it's set to off by default in current versions. If register_globals is off, you can't assume that any incoming variables are empty. You need to explicitly initialise them in order to prevent a user who knows or can guess what they're called from setting them in the URL browser-side. |
|
|||
|
Re: PHP problem in Apache/PHP/MySQL
Hey, I thought register globals is what allowed you to send dynamic information, not what naming structure it allowed you to use it in. I could be wrong though, on my local set up I cant remember if I set it on or off and im to lazy to open my ini file to figure out. But regardless, you should allways access your dynamic variables via the object refference. It makes keeping track of them a lot easier, and makes other people able to find them a lot better.
|
|
||||
|
Re: PHP problem in Apache/PHP/MySQL
register globals just lets you do exactly that - register variables that are global. So you can send info from one page to another.
But if register_globals is off, then you need to grab the data via post or get methods and store it in a variable. So if like you said you want to name it a certain way, then just:
|
![]() |
| Tags |
| php, problem, apachephpmysql |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Trainer Required for PHP MYSQL & APACHE | BBenson | Job Opportunities | 0 | Feb 9th, 2007 16:43 |
| PHP, MYSQL and Apache install | brunette | PHP Forum | 3 | Sep 14th, 2006 22:15 |
| PHP configuration problem. (or it could be Apache or XAMPP!) | Craigypoos | PHP Forum | 5 | Jul 3rd, 2006 12:12 |
| PHP-MySQL problem | robertboyle | PHP Forum | 4 | Jun 16th, 2006 13:02 |
| PHP Developer - Linux, Apache, MySQL - 12 month contract! | AN Agent | Job Opportunities | 0 | Mar 8th, 2006 08:23 |