/    Sign up×
Community /Pin to ProfileBookmark

mysql not working with php

I currently run two servers, Tomcat and regular Apache. Java/Tomcat works perfectly with mysql. As seen here: [URL=”http://92.236.70.82/”]Tomcat[/URL]

However if I try to run mysql on my normal apache server which is located here: [URL=”http://92.236.70.82:81/”]Apache[/URL] I get an error which you will see when u visit the link. Help much appreciated!

to post a comment
PHP

18 Comments(s)

Copy linkTweet thisAlerts:
@molchanovMay 16.2017 — Hi, I'd check that mysqli extension has been compiled with your php. Check 'ext folder'
Copy linkTweet thisAlerts:
@evo4everauthorMay 16.2017 — Hi, I'd check that mysqli extension has been compiled with your php. Check 'ext folder'[/QUOTE]

Yeah its there php_mysqli.dll
Copy linkTweet thisAlerts:
@molchanovMay 16.2017 — Can you please share a snippet then?
Copy linkTweet thisAlerts:
@evo4everauthorMay 16.2017 — yeah sure: Snippet
Copy linkTweet thisAlerts:
@molchanovMay 16.2017 — Sorry, I meant a piece of code where you get an error
Copy linkTweet thisAlerts:
@evo4everauthorMay 16.2017 — Can you please share a snippet then?[/QUOTE]

<?php

$servername = "localhost";

$username = "*****";

$password = "*
**
***";

// Create connection

$conn = mysqli_connect($servername, $username, $password);

// Check connection

if (!$conn) {

die("Connection failed: " . mysqli_connect_error());

}

echo "Connected successfully";

?>
Copy linkTweet thisAlerts:
@molchanovMay 16.2017 — I tried your code and it connects fine to the database.

Defintetely, it is not a PHP issue, but architectural.

What I would suggest first is to separate TomCat and Apache/Ngnix servr to different droplets.
Copy linkTweet thisAlerts:
@evo4everauthorMay 16.2017 — I tried your code and it connects fine to the database.

Defintetely, it is not a PHP issue, but architectural.

What I would suggest first is to separate TomCat and Apache/Ngnix servr to different droplets.[/QUOTE]


How do I do that? They run on different ports. Tomcat is on 80 and Apache is on 81
Copy linkTweet thisAlerts:
@evo4everauthorMay 16.2017 — TBH ive had this working in the past, just cant remember how
Copy linkTweet thisAlerts:
@evo4everauthorMay 16.2017 — PHP scripts themselves working perfectly on both servers. Java & Tomcat works perfectly with mysql, its just getting php to connect to mysql using Apache.
Copy linkTweet thisAlerts:
@ThrallixMay 17.2017 — Trade ports.
Copy linkTweet thisAlerts:
@evo4everauthorMay 17.2017 — Trade ports.[/QUOTE]

I'd rather not do that.. in fact I cant do that as Tomcat is my main web server. All my knowledge lies within Java/JSP.
Copy linkTweet thisAlerts:
@ThrallixMay 17.2017 — Apache is default 80, that's probably why you're facing issues.
Copy linkTweet thisAlerts:
@boleloveMay 17.2017 — I had a similar issue and once I removed Skype, it worked. Do you have skype?
Copy linkTweet thisAlerts:
@evo4everauthorMay 17.2017 — Apache is default 80, that's probably why you're facing issues.[/QUOTE]

I've changed Apache's default port to 81 in httpd.
Copy linkTweet thisAlerts:
@evo4everauthorMay 17.2017 — I had a similar issue and once I removed Skype, it worked. Do you have skype?[/QUOTE]

Yes I have Skype installed and I use it quite often. I'll give that a go and I'll report back!
Copy linkTweet thisAlerts:
@foxprodesignsMay 19.2017 — Hello,

I would love to suggest you consult with an expert about the errors.

Thanks,

I currently run two servers, Tomcat and regular Apache. Java/Tomcat works perfectly with mysql. As seen here: Tomcat

However if I try to run mysql on my normal apache server which is located here: Apache I get an error which you will see when u visit the link. Help much appreciated![/QUOTE]
Copy linkTweet thisAlerts:
@ZorgMay 20.2017 — Skype port 80 would be the issue if you were having this issue on your local machine or if you have skype installed on the external server. If that's not the issue, maybe a firewall is blocking port 3360 used by mysql, on your apache server, do you have a firewall on your apache server? If so you may have to manually config a rule to allow access to port 3306. Check your firewall rules.
×

Success!

Help @evo4ever spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.11,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...