Program working well in localhost,but not in the internet!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

manikandan
Forum Newbie
Posts: 10
Joined: Sat Oct 07, 2006 1:43 am

Program working well in localhost,but not in the internet!

Post 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
jito
Forum Commoner
Posts: 85
Joined: Sat Mar 25, 2006 4:32 am
Location: india

Post 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".
User avatar
aaronhall
DevNet Resident
Posts: 1040
Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:

Post by aaronhall »

What did you modify that made it stop working? Post some relevant code
manikandan
Forum Newbie
Posts: 10
Joined: Sat Oct 07, 2006 1:43 am

Post 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
miro_igov
Forum Contributor
Posts: 485
Joined: Fri Mar 31, 2006 5:06 am
Location: Bulgaria

Post by miro_igov »

What kind of company is that, where its employees don't have knowledge to do the job ?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

have you changed the database connection details so that it reflects the server confioguration?
manikandan
Forum Newbie
Posts: 10
Joined: Sat Oct 07, 2006 1:43 am

Post 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
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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";
}

?>
manikandan
Forum Newbie
Posts: 10
Joined: Sat Oct 07, 2006 1:43 am

Post 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
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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?
manikandan
Forum Newbie
Posts: 10
Joined: Sat Oct 07, 2006 1:43 am

Post by manikandan »

Dear Mr.volka
I'm using MySql for both localhost and server side.
Thanks & Regards,
Manikandan
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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?)
manikandan
Forum Newbie
Posts: 10
Joined: Sat Oct 07, 2006 1:43 am

Post 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
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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?
Post Reply