last day (15 days later) » 

06:15
0
A: Is it possible to use online databases in a local project?

lungjThe server name should be a fully qualified domain name that resolves to the IP address of the server with the database, or simply the IP address of the server. You need to make sure your database server accepts connections from your local machine and that remote accounts for your IP address have...

Please see the new image in my question
@Sigma That ip will not be changed soon.
Yes -- you will need to make sure your local machine's IP address is in the list of access hosts (and the MySQL root account must also have access permissions set for that IP address). Alternately, MySQL is happy to operate through an SSH tunnel: you can establish a tunnel from your local machine to the SQL server.
All my question is, how servername should look like? Is this correct? $servername = "pasargad.176.9.98.58";
Just 176.9.98.58 should be fine. I don't think pasargad.176.9.98.58 will work. Edit: I'm assuming that's your SQL server's IP address. The default MySQL port is blocked for remote access right now.
Anyway, it throws: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
06:15
Right: you'll need to make sure you can connect to port 3306 (by default) of your database server before you bother with your PHP script.
how can I test that?
Hi there..!
Are you on Linux/macOS or Windows? Or something else?
hi!
First of all, I don't know English very well, so please excuse me if you see any mistake in my comments
Your English is fine! My German is worse.
@lungj I use Cpanel
06:16
How about the computer you are using now?
Is it Windows?
Do you know if you have telnet installed?
not really. how can I figure it out?
telnet is a command-line program that lets you directly connect to remote servers. I'm doing a search for the installation procedure for Windows. It's an additional Windows component.
The link I just sent is for Windows 10.
lemme check it
Should I activate either "telnet client" or "telnet server"?
06:20
Client. Do not activate the server.
(the server gives everyone access to your computer with almost no security, so make sure it's off)
I see
Done! It's activated now
what's the next step?
Start a command prompt window
next?
06:22
Then run the following command: telnet 176.9.98.58 3306
If your server is listening for connections, you should see something about escape sequence and ^]
If it just sits there and nothing happens if you hit enter, then your server is ignoring SQL connections.
Connecting To 176.9.98.58...Could not open connection to the host, on port 3306. Connect failed
Okay. So that means that your SQL server isn't configured correctly and your PHP program has no hope of working until it is.
:-(
is there any next step?
Are you running your PHP program on your own computer?
06:24
or in the cloud
@lungj nope, in my own computer (localhost)
okay. Just to double check your IP address, you can go to whatismyip.com (no need to tell me your IP address)
Make sure in cPanel that your IP address is on the list of allowed hosts.
Are you able to run a command-line session on your SQL server?
I checked it out. It's totally correct.
@lungj sadly no
I don't have any server, I just bought a host which is working on Cpanel
That is your server :)
(or at least, your bit of a server)
yes :-) kinda
don't you have any other suggestion?
06:30
I haven't used a hosting site like the one you're using in a while (because of the lack of control and unpredictable performance), but I recall one of my old server providers required me to do non-standard things to use databases on other systems.
Is there a knowledge-base for your host? They may use a non-standard port for MySQL (instead of 3306).
Like a frequently asked questions page.
I guess it's 3306
Hm. Okay. Maybe they use a firewall like this: namecheap.com/support/knowledgebase/article.aspx/1249/89/…
Hopefully your host provides ssh access.
@lungj are you sure?
Am I sure about what?
about: my host provides ssh access
How can I connect to it through Putty?
06:33
Oh, no. I hope that they do.
Who is your host? I can do a quick check. your-server.de doesn't seem to have a page.
@lungj "your-server.de doesn't seem to have a page.", what page? you mean a website ?
Sorry, yes. I meant I couldn't find a website for it.
What is the website for the company you pay for your cPanel access?
ah ...!
wait
I don't read Arabic or whatever that was :(
well sadly it's Persian mihanwebhost.com
anyway, how can I check I have a ssh access to my host?
06:37
I only know a few words in Farsi and can't read a single one of them!
They should have a help page that tells you the server address.
@lungj Really? Are you familiar with Farsi? Where are you from?
No, I just know a couple of words. I'm from Canada, but I've worked with several people from Iran.
@lungj Nice .. I'm also from Iran
You can run telnet address 22 (once you find out what address to use)
anyway, ok, thx for the time you spent for me
06:39
My pleasure.
It's much better than the alternative for me: reading the newspapers. News these days are too sad!
which kind of news ?
political?
yes.
yes, some of them are too sad
how old are you?
Old enough
06:43
Okay, it looks like you might have SSH access.
Sounds you're a lady. Since you don't want to mention to your age exactly ;-)
@lungj how do you know that?
Uh, no. I'm just old.
This should show you how to see if you have ssh on cPanel: cpanel.com/media/tutorials/ssh.htm
If they do, then you can follow the instructions here: namecheap.com/support/knowledgebase/article.aspx/1249/89/… and install Putty. If you don't have ssh access, you'll need to contact technical support for mihanwebhost.
@lungj interesting .. but the link you provided uses an old version of Cpanel. In my Cpanel version, there is no SSH/Shell Access option
Unfortunately, not all companies give ssh access. I think you might need to contact mihanwebhost's technical support.
yes I have to
thx again
06:49
You either need ssh access (and then you can follow the instructions from namecheap) or you need server connection details for the mysql server. Good luck!
Have a nice day

last day (15 days later) »