Page 1 of 2
Program working well in localhost,but not in the internet!
Posted: Sat Oct 07, 2006 2:03 am
by manikandan
Hello frinz,
i'm new to this forum. i have developed a web based application program using PHP5,MySql. It s working well in internet. Now i had been modified one file(i'm not modifiying any of the DB based file,just modified application file alone). After modifying i upload that file into web server. That modified page alone not working well, i mean that page displays HTML content alone,it didn't fetch the data from DataBase. But this system working well in my localhost. Its not working well , when its uploaded into internet.
i don't know about the problem . Could you please help me to come out from this problem?
Thanking You in advance!
Regards,
Manikandan S
Posted: Sat Oct 07, 2006 3:14 am
by jito
can't say what's the problem without seeing the code, ur php.ini file and servers php.ini file can be different, so it's quite possible. check if you are working with register_globals="on".
Posted: Sat Oct 07, 2006 3:50 am
by aaronhall
What did you modify that made it stop working? Post some relevant code
Posted: Mon Oct 09, 2006 7:07 am
by manikandan
Dear frinz,
I'm working in the MNC company, due to the confidential of the code my project leader not allowing me to post my code here.I'm extremly sorry for that. And i checked both my localhost php.ini file and server's php.ini file, both are in same configuration. And register_globals is set to "off".
Thanks and Regards
manikandan s
Posted: Mon Oct 09, 2006 7:14 am
by miro_igov
What kind of company is that, where its employees don't have knowledge to do the job ?
Posted: Mon Oct 09, 2006 7:50 am
by Chris Corbyn
miro_igov wrote:What kind of company is that, where its employees don't have knowledge to do the job ?
There's no need for that. If you don't have anything contributory to say don't say anything.
Posted: Tue Oct 10, 2006 7:24 pm
by n00b Saibot
have you changed the database connection details so that it reflects the server confioguration?
Posted: Wed Oct 11, 2006 1:31 am
by manikandan
Dear Frinz,
I haven't changed any of my database related file, i just modified application files alone. Moreover i didn't change anything in both localhost, and server php.ini files too.
Thanks &Regards,
Manikandan
Posted: Wed Oct 11, 2006 2:24 am
by RobertGonzalez
Run the following in a new file (on both systems) and tell us the results please.
Code: Select all
<?php
$neg = array(0, false, '', null, 'off');
$ve = phpversion();
$os = PHP_OS;
$er = intval(error_reporting());
$rg = (in_array(strtolower(ini_get('register_globals')), $neg) ? 'Off' : 'On');
$de = (in_array(strtolower(ini_get('display_errors')), $neg) ? 'Off' : 'On');
$so = (in_array(strtolower(ini_get('short_open_tag')), $neg) ? 'Off' : 'On');
$le = '';
$cli = (php_sapi_name() == 'cli');
$eol = ($cli ? "\n" : "<br />\n");
$gle = get_loaded_extensions();
$rows = array();
$wide = 4;
$j = count($gle);
$pad = $wide - $j % $wide;
$len = max(array_map('strlen', $gle));
$func = create_function('$a', 'return str_pad($a, ' . intval($len) . ');');
$gle = array_map($func, $gle);
for($i = 0; $i < $j; $i += $wide)
{
$le .= ' ' . implode(' ', array_slice($gle, $i, $wide)) . "\n";
}
if ($cli)
{
$le = $eol . $le;
}
else
{
$le = '<pre>' . $le . '</pre>';
}
$ec = array(
'E_STRICT' => 2048, 'E_ALL' => 2047, 'E_USER_NOTICE' => 1024,
'E_USER_WARNING' => 512, 'E_USER_ERROR' => 256, 'E_COMPILE_WARNING' => 128,
'E_COMPILE_ERROR' => 64, 'E_CORE_WARNING' => 32, 'E_CORE_ERROR' => 16,
'E_NOTICE' => 8, 'E_PARSE' => 4, 'E_WARNING' => 2, 'E_ERROR' => 1,
);
$e = array();
$t = $er;
foreach ($ec as $n => $v)
{
if (($t & $v) == $v)
{
$e[] = $n;
$t ^= $v;
}
}
$er = $er . ' (' . implode(' | ', $e) . ')';
if (!$cli)
{
echo '<html><head><title>quick info</title></head><body>' . "\n";
}
echo 'PHP Version: ' . $ve . $eol;
echo 'PHP OS: ' . $os . $eol;
echo 'Error Reporting: ' . $er . $eol;
echo 'Register Globals: ' . $rg . $eol;
echo 'Short Tags: ' . $so . $eol;
echo 'Display Errors: ' . $de . $eol;
echo 'Loaded Extensions:' . $le . $eol;
if (!$cli)
{
echo '</body></html>' . "\n";
}
?>
Posted: Wed Oct 11, 2006 6:44 am
by manikandan
Dear Mr.Everah,
I have run your programs in both the localhost and in the server.
SERVER OUTPUT:
PHP Version: 4.3.2
PHP OS: SunOS
Error Reporting: 2039 (E_USER_NOTICE | E_USER_WARNING | E_USER_ERROR | E_COMPILE_WARNING | E_COMPILE_ERROR | E_CORE_WARNING | E_CORE_ERROR | E_PARSE | E_WARNING | E_ERROR)
Register Globals: Off
Short Tags: On
Display Errors: On
Loaded Extensions:
xml tokenizer standard session
posix pcre overload openssl
mbstring gettext dio dba
ctype zlib apache mysql
mcrypt
LOCALHOST OUTPUT:
PHP Version: 5.1.6
PHP OS: WINNT
Error Reporting: 2039 (E_USER_NOTICE | E_USER_WARNING | E_USER_ERROR | E_COMPILE_WARNING | E_COMPILE_ERROR | E_CORE_WARNING | E_CORE_ERROR | E_PARSE | E_WARNING | E_ERROR)
Register Globals: Off
Short Tags: On
Display Errors: On
Loaded Extensions:
bcmath calendar com_dotnet ctype
date ftp hash iconv
odbc pcre Reflection session
libxml standard tokenizer zlib
SimpleXML dom SPL wddx
xml xmlreader xmlwriter apache2handler
gd gettext imap mbstring
exif mime_magic ming mssql
mysql mysqli openssl pdf
PDO pdo_mssql pdo_mysql smtp
soap sockets SQLite xmlrpc
xsl zip
I'm awaiting for your reply sir,
Thanking you,
Regards,
Manikandan
Posted: Wed Oct 11, 2006 6:56 am
by volka
manikandan wrote:SERVER OUTPUT:
[...]
Loaded Extensions:
xml tokenizer standard session
posix pcre overload openssl
mbstring gettext dio dba
ctype zlib apache mysql
mcrypt
LOCALHOST OUTPUT:
[...]
Loaded Extensions:
bcmath calendar com_dotnet ctype
date ftp hash iconv
odbc pcre Reflection session
libxml standard tokenizer zlib
SimpleXML dom SPL wddx
xml xmlreader xmlwriter apache2handler
gd gettext imap mbstring
exif mime_magic ming mssql
mysql mysqli openssl pdf
PDO pdo_mssql pdo_mysql smtp
soap sockets SQLite xmlrpc
xsl zip
Your server-php only "knows" mysql while your localhost-php can use mysql(i), mssql and sqlite.
What type of database do you use?
Posted: Wed Oct 11, 2006 7:34 am
by manikandan
Dear Mr.volka
I'm using MySql for both localhost and server side.
Thanks & Regards,
Manikandan
Posted: Wed Oct 11, 2006 7:44 am
by volka
Does your code contain any error handling for the mysql operations?
The simplest is
Code: Select all
$db = mysql_connect(,,) or die(mysql_error())
mysql_select_db(,$db) or die(mysql_error());
$query = '...';
$result = mysql_query($query, $db) or die (mysql_error());
if ( 0==mysql_num_rows($result) ) {
echo 'no results';
}
Does your code contain something like this (maybe far more sophisticated)?
Is the code before and after the database querries executed? (Does it produce output?)
Posted: Wed Oct 11, 2006 7:59 am
by manikandan
Dear Mr.Volka,
Yes i'm using those kind of error handling mechanisms for mysql operations before the queries are executed.
Code: Select all
$db = mysql_connect(,,) or die(mysql_error())
mysql_select_db(,$db) or die(mysql_error());
$query = '...';
Thanks and Regards,
Manikandan
Posted: Wed Oct 11, 2006 8:02 am
by volka
Try something like
Code: Select all
$result = mysql_query($query, $db) or die (mysql_error());
echo "\n<div>Debug: ", mysql_num_rows($result), " records found.</div>\n";
Is the echo statement executed?
Does it find any matching records?