How to configure XAMPP to connect to MySQL remotely
I have a problem to connect my online MySQL database from my local system.
I installed XAMPP on my Windows 7 and created a PHP file with this code:
<?php
$db_path = mysqli_connect('printcity24.com', 'printci1_admin', 'xr10s20191', 'printci1_db', '3306');
if(!$db_path) {
echo mysqli_connect_error();
}else{
echo "Connected successfully";
}
?>
Then i created a database on my website : www.printcity24.com
My web host admin configured my host and opened firewall.
When i use XAMPP command line to connect to my database every thing is ok, i can connect to my database remotely with this code :
# mysql -u printci1_admin -p -h printcity24.com
but when i use php code to connect to my database i get this error :
Warning: mysqli_connect(): MySQL server has gone away in D:Xampp Serverhtdocsstindex.php on line 2
Warning: mysqli_connect(): (HY000/2006): MySQL server has gone away in D:Xampp Serverhtdocsstindex.php on line 2
MySQL server has gone away
I upload my php code on to other websites and test for connection and everything is "ok" but on my local xampp can't connect.
In this link said i have to use this command :
setsebool -P httpd_can_network_connect=1
but I don't know where to put this code and how to configure my xampp.
php mysql xampp
|
show 4 more comments
I have a problem to connect my online MySQL database from my local system.
I installed XAMPP on my Windows 7 and created a PHP file with this code:
<?php
$db_path = mysqli_connect('printcity24.com', 'printci1_admin', 'xr10s20191', 'printci1_db', '3306');
if(!$db_path) {
echo mysqli_connect_error();
}else{
echo "Connected successfully";
}
?>
Then i created a database on my website : www.printcity24.com
My web host admin configured my host and opened firewall.
When i use XAMPP command line to connect to my database every thing is ok, i can connect to my database remotely with this code :
# mysql -u printci1_admin -p -h printcity24.com
but when i use php code to connect to my database i get this error :
Warning: mysqli_connect(): MySQL server has gone away in D:Xampp Serverhtdocsstindex.php on line 2
Warning: mysqli_connect(): (HY000/2006): MySQL server has gone away in D:Xampp Serverhtdocsstindex.php on line 2
MySQL server has gone away
I upload my php code on to other websites and test for connection and everything is "ok" but on my local xampp can't connect.
In this link said i have to use this command :
setsebool -P httpd_can_network_connect=1
but I don't know where to put this code and how to configure my xampp.
php mysql xampp
The command aboutsetsebool
should be run on the shell - could you try that?
– Nico Haase
Nov 27 '18 at 9:04
thanks for your reply. i run this command on zampp shell and get error : setsebool is not recognized as an internal or external command, operable program or batch file.
– S R R
Nov 27 '18 at 9:18
try making sure that you execute the command from the directory setsebool.exe is in, or supply the absolute path to the executable.
– JoSSte
Nov 27 '18 at 11:29
could you get the providers to check if they get any oddities in the logs? stackoverflow.com/questions/10474922/… indicates something to do with packet size. I doubt that is the solution for you, but maybe the XAMPP server is generating something wrong / in anoder codepage or something like that... as I understand the error, your client actually gets contact to the serverm, and loses the connection.
– JoSSte
Nov 27 '18 at 11:39
@JoSSte , i don't know where is the setsebool directory and I set max_allow_packet=128M but still have problem. can you test to connect my database remotely from your computer please?
– S R R
Nov 27 '18 at 12:19
|
show 4 more comments
I have a problem to connect my online MySQL database from my local system.
I installed XAMPP on my Windows 7 and created a PHP file with this code:
<?php
$db_path = mysqli_connect('printcity24.com', 'printci1_admin', 'xr10s20191', 'printci1_db', '3306');
if(!$db_path) {
echo mysqli_connect_error();
}else{
echo "Connected successfully";
}
?>
Then i created a database on my website : www.printcity24.com
My web host admin configured my host and opened firewall.
When i use XAMPP command line to connect to my database every thing is ok, i can connect to my database remotely with this code :
# mysql -u printci1_admin -p -h printcity24.com
but when i use php code to connect to my database i get this error :
Warning: mysqli_connect(): MySQL server has gone away in D:Xampp Serverhtdocsstindex.php on line 2
Warning: mysqli_connect(): (HY000/2006): MySQL server has gone away in D:Xampp Serverhtdocsstindex.php on line 2
MySQL server has gone away
I upload my php code on to other websites and test for connection and everything is "ok" but on my local xampp can't connect.
In this link said i have to use this command :
setsebool -P httpd_can_network_connect=1
but I don't know where to put this code and how to configure my xampp.
php mysql xampp
I have a problem to connect my online MySQL database from my local system.
I installed XAMPP on my Windows 7 and created a PHP file with this code:
<?php
$db_path = mysqli_connect('printcity24.com', 'printci1_admin', 'xr10s20191', 'printci1_db', '3306');
if(!$db_path) {
echo mysqli_connect_error();
}else{
echo "Connected successfully";
}
?>
Then i created a database on my website : www.printcity24.com
My web host admin configured my host and opened firewall.
When i use XAMPP command line to connect to my database every thing is ok, i can connect to my database remotely with this code :
# mysql -u printci1_admin -p -h printcity24.com
but when i use php code to connect to my database i get this error :
Warning: mysqli_connect(): MySQL server has gone away in D:Xampp Serverhtdocsstindex.php on line 2
Warning: mysqli_connect(): (HY000/2006): MySQL server has gone away in D:Xampp Serverhtdocsstindex.php on line 2
MySQL server has gone away
I upload my php code on to other websites and test for connection and everything is "ok" but on my local xampp can't connect.
In this link said i have to use this command :
setsebool -P httpd_can_network_connect=1
but I don't know where to put this code and how to configure my xampp.
php mysql xampp
php mysql xampp
edited Nov 27 '18 at 9:10
halfer
14.6k758113
14.6k758113
asked Nov 27 '18 at 9:00
S R RS R R
336
336
The command aboutsetsebool
should be run on the shell - could you try that?
– Nico Haase
Nov 27 '18 at 9:04
thanks for your reply. i run this command on zampp shell and get error : setsebool is not recognized as an internal or external command, operable program or batch file.
– S R R
Nov 27 '18 at 9:18
try making sure that you execute the command from the directory setsebool.exe is in, or supply the absolute path to the executable.
– JoSSte
Nov 27 '18 at 11:29
could you get the providers to check if they get any oddities in the logs? stackoverflow.com/questions/10474922/… indicates something to do with packet size. I doubt that is the solution for you, but maybe the XAMPP server is generating something wrong / in anoder codepage or something like that... as I understand the error, your client actually gets contact to the serverm, and loses the connection.
– JoSSte
Nov 27 '18 at 11:39
@JoSSte , i don't know where is the setsebool directory and I set max_allow_packet=128M but still have problem. can you test to connect my database remotely from your computer please?
– S R R
Nov 27 '18 at 12:19
|
show 4 more comments
The command aboutsetsebool
should be run on the shell - could you try that?
– Nico Haase
Nov 27 '18 at 9:04
thanks for your reply. i run this command on zampp shell and get error : setsebool is not recognized as an internal or external command, operable program or batch file.
– S R R
Nov 27 '18 at 9:18
try making sure that you execute the command from the directory setsebool.exe is in, or supply the absolute path to the executable.
– JoSSte
Nov 27 '18 at 11:29
could you get the providers to check if they get any oddities in the logs? stackoverflow.com/questions/10474922/… indicates something to do with packet size. I doubt that is the solution for you, but maybe the XAMPP server is generating something wrong / in anoder codepage or something like that... as I understand the error, your client actually gets contact to the serverm, and loses the connection.
– JoSSte
Nov 27 '18 at 11:39
@JoSSte , i don't know where is the setsebool directory and I set max_allow_packet=128M but still have problem. can you test to connect my database remotely from your computer please?
– S R R
Nov 27 '18 at 12:19
The command about
setsebool
should be run on the shell - could you try that?– Nico Haase
Nov 27 '18 at 9:04
The command about
setsebool
should be run on the shell - could you try that?– Nico Haase
Nov 27 '18 at 9:04
thanks for your reply. i run this command on zampp shell and get error : setsebool is not recognized as an internal or external command, operable program or batch file.
– S R R
Nov 27 '18 at 9:18
thanks for your reply. i run this command on zampp shell and get error : setsebool is not recognized as an internal or external command, operable program or batch file.
– S R R
Nov 27 '18 at 9:18
try making sure that you execute the command from the directory setsebool.exe is in, or supply the absolute path to the executable.
– JoSSte
Nov 27 '18 at 11:29
try making sure that you execute the command from the directory setsebool.exe is in, or supply the absolute path to the executable.
– JoSSte
Nov 27 '18 at 11:29
could you get the providers to check if they get any oddities in the logs? stackoverflow.com/questions/10474922/… indicates something to do with packet size. I doubt that is the solution for you, but maybe the XAMPP server is generating something wrong / in anoder codepage or something like that... as I understand the error, your client actually gets contact to the serverm, and loses the connection.
– JoSSte
Nov 27 '18 at 11:39
could you get the providers to check if they get any oddities in the logs? stackoverflow.com/questions/10474922/… indicates something to do with packet size. I doubt that is the solution for you, but maybe the XAMPP server is generating something wrong / in anoder codepage or something like that... as I understand the error, your client actually gets contact to the serverm, and loses the connection.
– JoSSte
Nov 27 '18 at 11:39
@JoSSte , i don't know where is the setsebool directory and I set max_allow_packet=128M but still have problem. can you test to connect my database remotely from your computer please?
– S R R
Nov 27 '18 at 12:19
@JoSSte , i don't know where is the setsebool directory and I set max_allow_packet=128M but still have problem. can you test to connect my database remotely from your computer please?
– S R R
Nov 27 '18 at 12:19
|
show 4 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53495957%2fhow-to-configure-xampp-to-connect-to-mysql-remotely%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53495957%2fhow-to-configure-xampp-to-connect-to-mysql-remotely%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
The command about
setsebool
should be run on the shell - could you try that?– Nico Haase
Nov 27 '18 at 9:04
thanks for your reply. i run this command on zampp shell and get error : setsebool is not recognized as an internal or external command, operable program or batch file.
– S R R
Nov 27 '18 at 9:18
try making sure that you execute the command from the directory setsebool.exe is in, or supply the absolute path to the executable.
– JoSSte
Nov 27 '18 at 11:29
could you get the providers to check if they get any oddities in the logs? stackoverflow.com/questions/10474922/… indicates something to do with packet size. I doubt that is the solution for you, but maybe the XAMPP server is generating something wrong / in anoder codepage or something like that... as I understand the error, your client actually gets contact to the serverm, and loses the connection.
– JoSSte
Nov 27 '18 at 11:39
@JoSSte , i don't know where is the setsebool directory and I set max_allow_packet=128M but still have problem. can you test to connect my database remotely from your computer please?
– S R R
Nov 27 '18 at 12:19