dcsimg
www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 19

Thread: mysql not working with php

  1. #1
    Join Date
    May 2017
    Posts
    10

    mysql not working with php

    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!

  2. #2
    Join Date
    May 2017
    Posts
    4
    Hi, I'd check that mysqli extension has been compiled with your php. Check 'ext folder'

  3. #3
    Join Date
    May 2017
    Posts
    10
    Quote Originally Posted by molchanov View Post
    Hi, I'd check that mysqli extension has been compiled with your php. Check 'ext folder'
    Yeah its there php_mysqli.dll

  4. #4
    Join Date
    May 2017
    Posts
    4
    Can you please share a snippet then?

  5. #5
    Join Date
    May 2017
    Posts
    10
    yeah sure: Snippet

  6. #6
    Join Date
    May 2017
    Posts
    4
    Sorry, I meant a piece of code where you get an error

  7. #7
    Join Date
    May 2017
    Posts
    10
    Quote Originally Posted by molchanov View Post
    Can you please share a snippet then?
    <?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";

    ?>

  8. #8
    Join Date
    May 2017
    Posts
    4
    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.

  9. #9
    Join Date
    May 2017
    Posts
    10
    Quote Originally Posted by molchanov View Post
    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.
    How do I do that? They run on different ports. Tomcat is on 80 and Apache is on 81

  10. #10
    Join Date
    May 2017
    Posts
    10
    TBH ive had this working in the past, just cant remember how

  11. #11
    Join Date
    May 2017
    Posts
    10
    PHP scripts themselves working perfectly on both servers. Java & Tomcat works perfectly with mysql, its just getting php to connect to mysql using Apache.

  12. #12
    Join Date
    Mar 2017
    Posts
    5
    Trade ports.

  13. #13
    Join Date
    May 2017
    Posts
    10
    Quote Originally Posted by Thrallix View Post
    Trade ports.
    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.

  14. #14
    Join Date
    Mar 2017
    Posts
    5
    Apache is default 80, that's probably why you're facing issues.

  15. #15
    Join Date
    May 2017
    Posts
    6
    I had a similar issue and once I removed Skype, it worked. Do you have skype?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles