PHP has no way to access the IP from the intranet through the extranet mapping

Source: Internet
Author: User
Tags php server php and mysql
PHP has no way to access the IP from the intranet via the extranet mapping
This is the case, the server intranet address is: 192.168.28.154,php code and MySQL database are here.

Then PHP needs to link to the database, so it's written in the PHP code:
$dbhost = "192.168.28.154";
...
mysql_connect ("localhost",
...

Now, you may be the PHP code with the MySQL database to deploy to other servers, but I hope that the PHP code can not be modified, then, how to get the current deployment code in PHP server IP address?

Note: An extranet map is set up here: 58.240.33.174:20280, which can be accessed by others via this IP.
------Solution--------------------
If you want to deploy an intranet server, that can not need to change, but if your database is not a LAN or a server to access the intranet, then you have to move the database to the outside network, or you will have to change the database link to the program.
------Solution--------------------
Both PHP and MySQL are on the same machine.
Then connect MySQL with Locathost rather than IP
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.