Jump to content
  • 0

Top PHP Scripts. How to connect from webserver to database?


Question

Posted

Hi I want to use php scripts to rank players, but I can't get the scripts to connect to my database. I am using the default port 3306, which is opened on my router.

 

Since I am behind a router would I have to include the port some where? How would it know which computer to connect to?

 

$db_link = mysql_connect('host', 'user', 'password');

 

 

Any help would be appreciated :)

14 answers to this question

Recommended Posts

  • 0
Posted

Thx for the reply. I am using a Linksys router. Would that be under

 

Applications and Gaming -> Port Triggering

 

I have only opened ports on my router I've never needed to point a port to a specific machine, so Im not exactly sure what to search. :(

  • 0
Posted

We are talking about the same thing!

Do the same thing about 3306 tcp/udp port...

You also have to create a user for the database that accepts connections from remote machines.

  • 0
Posted

Yeap... it seems to be the right one.

 

For a detailed guide find your router in this list: http://portforward.com/english/applications/port_forwarding/MySQL_Server/MySQL_Serverindex.htm

  • 0
Posted

They don't have a guide for my router.

 

My ports are already open and I made a MySQL user. That image I posted earlier also doesn't seem like the right page because it doesn't have the IP of the computer I want it to connect to... I checked "Canyouseeme.org" and port 3306 is open but now I have no way of telling the script which computer to connect to on that IP.

 

 

  • 0
Posted

Oops, I thought it was port range forward which is the right one!

Can you give me a clear summary of your project?

Where is the mysql server? Where is the webserver? Where is the game server?

 

 


If the web server is hosted on a remote machine and the database server on localhost, you have to use the ROUTER'S IP(your WAN ip, www.whatismyip.com) on your php scripts...

  • 0
Posted

I have a test game server on my dedicated PC which has opened ports and players from other countries can connect with no problem so stuff like that isn't blocked.

 

My web server with the stats script is through a web hosting company

  • 0
Posted

Why the hell do you want to open your Router's ports?

 

Ask your company if 3306 is open...

The IP(/hostname) you have to use on php scripts is the server's one.

 

Let me explain you something.

Your PC has nothing to do with the webserver or the gameserver(including the mysql server)...

The only connection we need here is between the webserver and the mysql server, thus the server's 3306 tcp/udp port needs to be open.

  • 0
Posted

Im sorry for the confusion.. Let me explain just to be clear.

 

Web Server - Has the PHP scripts loaded on it. Hosted by a web company

 

Game Server - This is hosted on my LAN, thats why I opened the ports 3306 tcp/udp on my router.

 

MySQL Server - This is hosted on the same PC as the game server.

 

---------------------

 

I just tried installing WAMP on the server PC. I successfully got the php scripts to load and connect to the database.

 

When I set up the MySQL connection I made sure to check "Allow access from remote machines", and I opened the ports, but the scripts still don't connect to the database when they are uploaded to a remote web server.

 

  • 0
Posted

Thank you for clearing out the whole situation.

My basic knowledge says "Allow access from remote machines" is not enough.

Open navicat or any MySQL server browser and go to the user creation menu.

Fill in the fields with your settings and as a "host" put the webserver's IP or hostname(however, you can use the symbol "%" to allow access from ANY remote host).

navicat-create-blogger-user-with-pw-123451.png

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • Google Ads Accounts — a tool for scaling advertising Google Ads is one of the most effective advertising platforms in the world. Google Ads accounts allow you to: — promote products and services through Google search; — launch targeted advertising in different countries; — attract new customers and increase sales; — set up campaigns for specific goals: traffic, leads, conversions; — optimize expenses and control advertising performance. Having Google Ads accounts provides access to a wide audience and helps maximize the potential of the Google advertising network. Our store’s assortment of Google Ads accounts includes: Google Ads Account USA/EUROPE (UK, Germany, France, etc.) | Manually farmed 7+ days | Created ad account | Includes 2FA, backup codes, backup email, UserAgent, Cookies | Price from: $13.00 Google Ads Account USA/EUROPE | VERIFICATION COMPLETED – €10 BILL | Manually farmed 7+ days | Ad created | Includes 2FA, backup email, UserAgent, Cookies | Price from: $55.00 Google Ads Account EUROPE/USA with ad campaigns and spend $100/$500/$1000+ | Verification not completed | Full access & setup | Price from: $200.00 Google Ads Account EUROPE/USA with ad campaigns and spend $100/$500/$1000+ | Verification completed | Full access & setup | Price from: $400.00 Current links: Digital goods store (Website): Go Telegram bot for purchasing Telegram Stars: Go SMM Panel: Go – promotion of your social media accounts. Store Telegram bot: Go Promotions and special offers: 1. Promo code SEPTEMBER2025 (10% discount) for purchases in our store (Website, bot) in September! You can also use the promo code for your first purchase: SOCNET (15% discount) 2. Get $1 credited to your store balance or a 10-20% discount, just write your username after registering on our website using the following template: "SEND ME BONUS, MY USERNAME IS..." – you need to post it in our forum thread! 3. Get $1 for your first trial run of the SMM Panel: just open a ticket with the subject “Get Trial Bonus” on our website (Support). 4. Weekly giveaways of Telegram Stars in our Telegram channel and in our bot for purchasing stars! News resources: ➡ Telegram channel: https://t.me/accsforyou_shop ➡ WhatsApp channel: https://whatsapp.com/channel/0029Vau0CMX002TGkD4uHa2n ➡ Discord server: https://discord.gg/y9AStFFsrh We are actively seeking suppliers for the following product categories: — Snapchat old and new accounts | With snapscores | Geo: Europe/USA | Full access via email/phone number — Reddit old accounts with post and comment karma from 100 to 100,000+ | Full access via email — LinkedIn old accounts with real connections | Geo: Europe/USA | Full access via email + active 2FA password — Instagram old accounts (2010-2023) | Full access via email (possibly with active 2FA password) — Facebook old accounts (2010-2023) | Full access via email (possibly with active 2FA password) | With or without friends | Geo: Europe/USA/Asia — Threads accounts | Full access via email (possibly with active 2FA password) — TikTok/Facebook/Google ADS Agency advertising accounts Contact us at the details below — let’s discuss the terms! We are always open to other partnership offers as well. Contacts and support: ➡ Telegram: https://t.me/socnet_support  ➡ WhatsApp: https://wa.me/79051904467  ➡ Discord: socnet_support  ➡ ✉ Email: solomonbog@socnet.store  Through these contacts you can also: — get consultation on wholesale purchases — establish a partnership (current partners: https://socnet.bgng.io/partners ) — become our supplier SocNet — store for digital goods and premium subscriptions 
    • try to remove this AI.obj or use it is functional https://www.mediafire.com/file/2g4d3o5hd0ca48o/ai.obj/file
    • Done. Thanks for your choose and trust us, we are the only and LAST, authentic L2OFF Service.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock