How to set database connection when host denies access from outside?

Perfect. I changed the parameters directly in the file and it works perfectly now! Thank you @Dave for this hint!
@Teodor it would be useful to disable automatic connection test when saving. There already is a “Test connection” button which should suffice.

1 Like

Am happy to have helped. More often than not finding a work-around is a common occurrence in web-app development. No matter the software, the client, or all the best laid planning and preparation!

:slight_smile:

1 Like

Problem with disabling auto test on save is that wappler reads the database structure at that point so changes in database structure won’t be detected.

1 Like

Ok that is good to know! So it’s a matter of basic functionality rather than workflow.

Hey Brian,
Can you explain what is wrong with setting up a database connection for the selected target? I don’t really understand what the issue is and what is wrong with the workflow.

Pretty much fully covered in this thread

The issue is, I can’t upload the PHP action file to the target with the right parameters because Wappler doesn’t let me save the remote database parameters when the database isn’t accessible from the computer. So it’s kind of a vicious circle.

Sorry @Teodor, this is the thread I meant to post.
Mysql connections - ISP remote connections and development to production upload setting changes

Just by the way, if anybody uses StackPath as a content delivery network you will find the same issue, the only way around it is to add the IP into the cPanel Remote SQL Connection list or you can not gain access and vice versa, you also have to go into StackPath and add the IP of your remote server into their Allow List in the firewall or it will not play nice at all.

1 Like

That’s why you need to setup a new Target, pointing to your server. Then switch to it, then edit your database connection step and enter the new database details. On save the file will be pushed to your remote server and connection will be made.

Actually to your website the database is not remote but local. So that is why you usually use localhost as address for your database server.

When the Wappler connection file gets uploaded to your site it gets executed there and connects “locally” to your database server

@Teodor. Wappler makes a connection to the database to check the connection settings before you can save them. If your mysql server does not accept remote connections then the initial connection check fails and you cannot save the settings and therefore they are not uploaded to the server. As @jowhiskey says it’s vicious circle. @George

That is not how it works. It connects through your server, as it pushes the files there - and that is not a remote access.
Wappler never requires remote connection. That is why you must setup your target to point to your remote server.

That is not true @Hyperbytes as I explained above Wappler accesses the database through your web server. So usually the database it is always localhost as it is from the point of view of your web server

Ok, i am not in the office at moment to check but i will later and video the issue. My provider does not allow remote access, I have never been able to connect directly to online databases with Wappler and i am not alone with that issue. I have to work locally then manually change the settings when going live.

1 Like

But manually changing the settings in the file is the same as changing them through the UI. On save this file is pushed to your server - then the script connects from the server, which already explained above is not a remote connection …

so just to resume - just leave the default “localhost” as database server name and it should be all ok :slight_smile:

Wappler never uses remote database connections, so there is no point of using remote address. It just uploads the file to your web server and access the database from there.

Neither my local or online provider use localhost. Very few seem to now.

I will set up an online database and send you the settings later and see if you can create a connection.

well if your database is on a different ip than your web server - then it is remote to your web server. But then remote connections are allowed from your web server to your database server (otherwise you never can access your database from your site)

But usually mysql databases created with panels like cpanel, plesk etc resides on the same server used as web server. So that is why localhost.