PDA

View Full Version : Local machine vs Real Web Server issues


nubian
05-23-2008, 04:18 PM
i'm running into a flash and php issue.

in my flash movie i have 3 text fields
source: (type intput)
criteria: (type input)
result: (dynamic type)

and a button with the following code:

on (release) {
result = "Searching...";
loadVariables ("search.php", this, "POST");
}



this is my search.php


<?
$result = str_replace($criteria, "<b>$criteria</b>", $source);
print "&result=" . urlencode($result);
?>



ok...here is where i'm getting lost.

if i were to load the contents above from a "real" web server it works just fine.
if i were to load the contents above from a "local" server it does not work.

my apache server setup on my local windows machine is as follows:

Apache/1.3.41 (Win32)
PHP Version 5.2.6
MySQL 5.0.51a
phpMyAdmin - 2.11.6

but if i were to modify my search.php file like so:


<?
$source = stripslashes($HTTP_POST_VARS['source']);
$criteria = stripslashes($HTTP_POST_VARS['criteria']);
$result = str_replace($criteria, "<b>$criteria</b>", $source);
echo "result=$result";
?>


...it works on my windows local apache server just fine.
are there any configurations that need to be done in order for my local machine to behave in the same manner as my real web server?

any help on how to achieve this will greatly be appreciated.
thank you in advance.

ASWC
05-23-2008, 04:45 PM
That might have to do with PHP version. Did you check the php version on the "real" server.

nubian
05-23-2008, 05:22 PM
the version on my real server is:
PHP Version 4.4.4.

i'd like to test this locally with 4.4.4 but i'm unable to find it.
the latest version i can find is 4.4.8.

ASWC
05-23-2008, 06:00 PM
To deal with different version of PHP we usualy write if statements and run code according to the version we find. I'm affraid you'll have to do this.

nubian
05-23-2008, 06:05 PM
i just temporarily disabled php5 (local machine) and installed php 4.4.8 and it still does the same thing. not too sure how much of a difference there was between php 4.4.4 and 4.4.8.

ASWC
05-23-2008, 06:22 PM
Yeah I don't know either. It's annoying this version stuff but I don't see how you can avoiding checking for methods and properties availability in your code anyway. Probably better would be to go see a PHP forum where people would probably have more knowledge about this.

jsebrech
05-26-2008, 08:13 AM
If you need to run stripslashes, that could be because magic_quotes_gpc is enabled in php.ini (which is bad practice, so this should be disabled). I would advise comparing php.ini configurations (by running a script "<?php phpinfo(); ?>" on both machines).