Hi,

I developed a website with PHP version 5.1.4 and MySQL - 5.0.22. I tested the web on my localhost and it worked perfectly well. However, when I uploaded the website, I could not have access to all have to all the data inserted in my database. I could not understand the reason for this. However, after complaining to the hosting company, it was suggested that probably there is a difference in the php.ini of my localhost and that of the hosting company. The php.ini of the web hosting company is Debian, MySQL Version: 5.0.91, Perl Version: 5.8.8. Being a newbie in this, is it possible that the difference in this developmental portal and the hosting portal could lead to my inability to access of my data in the database of the hosting company?

Thanks.

Dani AI

Generated

Brief, practical checklist to diagnose why a site that works locally does not show the expected rows on the hosted server — building on ’s connection-test suggestion and ’s PHP-version question for .

First, verify the production database actually contains the same rows as local. Using phpMyAdmin or the MySQL CLI, compare row counts for the key tables (for example run SELECT COUNT(*) FROM table_name; on both environments). A safe export/import is done with mysqldump and the mysql client:

mysqldump -u user -p dbname > dump.sql
mysql -u user -p dbname < dump.sql

(See the mysqldump manual: https://dev.mysql.com/doc/refman/5.0/en/mysqldump.html.)

Common, often-missed causes

  • Table/name case-sensitivity: Windows dev setups are frequently case-insensitive while Linux hosts are not; a table named Users locally but referenced as users in code can silently fail on the host. Read MySQL’s identifier case-sensitivity notes: https://dev.mysql.com/doc/refman/5.0/en/identifier-case-sensitivity.html.
  • Database name or table-name prefixes added by the host control panel (so the exported data goes into a different database/table than the site expects).
  • Missing or partial import — export failures or timeouts can leave production data incomplete.

Check the PHP/runtime side

  • Produce a phpinfo() page on the host to compare loaded extensions, default sockets and php.ini values with the local environment:
<?php
phpinfo();

Privileges and configuration

  • Confirm the MySQL account and host permissions ('user'@'hostname') allow the web server to read the database. A typical grant (run on the MySQL server as admin) looks like:
GRANT ALL PRIVILEGES ON dbname.* TO 'user'@'hostname' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;

(See GRANT docs: https://dev.mysql.com/doc/refman/5.0/en/grant.html.)

Also consider SQL modes, charset/collation differences and storage-engine behavior — any of these can change query results or reject inserts. Running the above comparisons (data counts, phpinfo(), error logs, and privileges) typically reveals whether the issue is a missing import, a naming/permission problem, or a runtime/configuration difference.

Recommended Answers

All 4 Replies

I suggest you to create a simple file and try the connection and a query to your database, something like this:

<?php

# config parameters
$host = '';
$user = '';
$pass = '';
$db = '';
$table = '';

$conn = mysql_connect($host,$user,$pass);
if (!$conn)
{
        die('connection error: ' . mysql_error());
}

mysql_select_db($db, $conn) or die('database error: '.mysql_error());

$q = mysql_query("select * from $table") or die('query error: ' .mysql_error());
echo 'result: ' . mysql_num_rows($q);
?>

This is very basic, try if it works and if you're in doubt, post back any error you get.
P.S. remember to set the correct config parameters.

Thanks Cereal. I have done this in my localhost and it works well. I copied this same file to the hosting company, with some modifications, taking into cognizance their host. It was from here that I am having issues. I am open to further suggestions.

Ok, when you've tried this on your hosting did you got any errors? If yes, can you paste the output here? I suggested you this test just to check if the connection with the database of the hosting was working fine.

Otherwise post your code or at least a simplified version of it in which the problem is occurring. If I don't understand which kind of error you get I cannot help.

Member Avatar for Member #46692

What is the php version of your hosting company? You mentioned perl or was that a typo?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.