Shared Hosting Limitations...

Hi,

I've been trying to use the data in my database on my Wordpress website. All hosted in the same place/same cpanel. I cannot get my code to make a connection, not even a "connect failed"....
I'm using a custom template via a page.

When I use my WAMP server, everything works.

I got on the chat with a guy at host and he said  
"You should understand that the same code that worked on WAMP server will not work here as all our servers are Linux based"

Then he said
"Regarding database connect, I need to warn you that incoming remote MySQL connection is disabled on our Shared, Reseller and Business servers due to security reasons."

Does this sound right? And why will my WAMP server work?

Thanks
D
dlewis61Asked:
Who is Participating?
 
Chris StanyonCommented:
It's a fairly common set up on a shared hosting platforms to prevent remote connections to your database, but that doesn't sound like the problem.

What it means is that you can't make a remote connection to your database i.e run a script on one server that tries to communicate with your database on another server. When you run scripts such as WordPress, you are connecting to a database on the same server, so relative to your script, the database is hosted on 'localhost' - it's considered a local connection and doesn't get blocked like a remote connection would. If your scripts are running on the same server as the database, then make sure you set the DB host to localhost. Anything else will probably fail.

The fact that it runs on your WAMP server could simply be down to your local configuration.

As for the not working because it's a Linux system - sounds like a croc to me - I do all my development work on a Windows PC running WAMP and it transfers seemlessly to my linux-based hosting accounts without any problems. There may be some differences, but standard PHP is standard PHP, so I think your tech support guy is probably spinning you a yarn :) Connecting to your MySQL DB on a WAMP Stack is identical to doing it on a LAMP stack!

If you need remote connection to your database, then consider switching your hosting company. Generally when companies disable features in the interest of 'security' it's because they haven't set up their security right in the first place.
0
 
David Johnson, CD, MVPOwnerCommented:
on the hosting site you should be given a mysql connection string and you will have to export and then import the mysql data from your local mysql instance into the hosted mysql instance
0
 
Ray PaseurCommented:
Sounds like you might be using GoDaddy.  You can find really good WordPress hosting here:
https://wordpress.org/hosting/
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
David Johnson, CD, MVPOwnerCommented:
if using godaddy the servername is localhost http://bit.ly/1AEXm14
0
 
dlewis61Author Commented:
I'm actually using Namecheap....
0
 
Dave BaldwinFixer of ProblemsCommented:
I agree with everything Chris said.  Godaddy let's you set up your databases to be 'localhost' only or remotely accessible.  But once it is set up, you can not change it.  You would have to create a new database and import all of your data.  I have several sites that I support that do not allow external database connections for 'security'.  One of them is Penguin hosting which is actually on Chihost.  I also found out that some Wordpress installs on hosting sites are 'closed' set ups where you are not given access to the database except thru the Wordpress admin pages.
0
 
Kuldeep NegiCommented:
If you are looking for the error free hosting for your wordpress website with 24*7 customer support, visit here: https://www.vkareit.in/wordpress-hosting.php
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.