I've been mucking around with Flash Builder (beta 2) and trying to get some PHP services hooked up. It's dead simple through FB assuming no hiccups. But I've been hiccupping for days now.

I'm running the latest WAMP install with only one modification mentioned below (fresh install) on WinXPSP2.

TO sum up, I have a very simple DB table set up, primary key + 4 other fields. I have a sample PHP service set up to talk communicate with MySQL and receive the table row data. However, whether I try to connect through FB, or just running a test.php which utilises the same PHP service, I get these errors from MySQL:

**Warning: mysqli_connect() [function.mysqli-connect]: MySQL server has gone away in C:\wamp\www\PHPService\services\EmployeeService.php on line 33

Warning: mysqli_connect() [function.mysqli-connect]: Error while reading greeting packet. PID=1024 in C:\wamp\www\PHPService\services\EmployeeService.php on line 33

Warning: mysqli_connect() [function.mysqli-connect]: (HY000/2006): MySQL server has gone away in C:\wamp\www\PHPService\services\EmployeeService.php on line 33

Fatal error: Maximum execution time of 60 seconds exceeded in C:\wamp\www\PHPService\services\EmployeeService.php on line 27**

As suggested on an Adobe FB forum, I tried increasing my default 'max_execution_time = 30 ;' in php.ini upto 120, 240 and then 360 in that order. No cigar.

This url: http://www.codefinger.co.nz/_etc/mySQLError.zip contains;

  • MySQL Database table I'm using
  • EmployeeService.php as seen i the above error
  • test.php, in the same folder as EmployeeService.php

Any help appreciated, I'm no MySQL or PHP wiz, everything provided has been taken from online example materials from Adobe, all I've done is put in my own DB details and an altered version of 'EmployeeService.php' to reflect the data I'm trying to get from MySQL.

If you're keen to help and I haven't included some vital logs or whatnot, just holler and maybe let me know where I can find what you need to troubleshoot.

Cheers, - danjah

[edit] I should note that in 'EmployeeService.php' you'll see I commented out the username/pswd settings, just to test if that was a problem, I have tried it with the correct creds though (the commented ones). I also turned my firewall off temporarily while testing, shrug.

| improve this question | | | | |

The problem is connecting to your MySQL server. You are able to connect via phpMyAdmin, correct? So MySQL itself appears to be connected correctly.

Looking at your code, this looks very very suspicious:

  var $server = "localhost"; 
  var $port = "80"; 

Port 3306 is the default MySQL port, but you may have configured yours to run on something else, I don't know. But running MySQL on port 80 would be pretty dumb, since that's the port for HTTP. I assume you have a webserver (Apache) running on that port, since you mentioned WAMP. Unless you changed Apache to run on a different port, which would be even weirder.

| improve this answer | | | | |
  • 1
    Amazing, thank you both - you're spot on. Some times it's the little things which really bring me crashing down. Huge thanks for the debugging - now onto the more exciting things :) – danjah Feb 28 '10 at 20:50

After a whack of debugging and trial and error, I've found that the culprit is the inclusion of the 'port number' when connecting to the MySQL database.

By removing the port arg, everything worked.

The port arg is obviously there for a reason, so instead of remaining ignorant, can anybody tell me why the port number (the value is 80) causes these errors? PHPinfo tells me port 80 is being listened to, and I even tried this with my firewall down.

| improve this answer | | | | |

Port 80 is http, port 3306 (the default) is where MySQL listens, if you were telling php to connect to the mysql server on port 80 then that explains why you couldn't connect. Removing the port argument, and letting it use the default would explain why it worked.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.