Visual Studio kills MySQL
Page 1 of 2 12 LastLast
Results 1 to 15 of 22

Thread: Visual Studio kills MySQL

  1. #1
    Senior Member
    Join Date
    Aug 2002
    Location
    Florida Sun Coast
    Posts
    224

    Question Visual Studio kills MySQL

    I installed Visual Web Developer 2010 Express (a freebie "Visual Studio") on a Win7 machine to have a look at ASP.Net (yeah, sacrilegious, I know) and it completely put the kobosh on XAMPP (took over port 80). I was unable to connect to localhost. So, I changed the port setting to 8080, but XAMPP refused to accept this change, no matter how many .conf or .ini files I checked. At this point, I switched over to WAMP and was able to set the port to 8080 with no problem.

    So now I can connect to localhost (127.0.0.1) again. But one last problem remains: I cannot connect to MySQL. I keep getting the error "Call to undefined function mysql_connect() in C:\wamp\www\. . ." No matter what I try (short of uninstalling Visual Web Dev) I cannot revolve this issue. I cannot access my database because WAMP cannot make the connection because it can't even find the connection function. And phpinfo() shows that MySQL is not enabled (listed)! So, I know this has to be a set-up issue somehow. Interestingly enough, I can see my database using SQLYog, a 3rd party DBMS.

    Somehow the installation of Web Dev 2010 has caused this problem because either server (XAMPP or WAMP) worked just fine before this installation. I've had no luck finding any patch for this.

    Note: I'm running Apache 2.2, PHP 5.3.1 and MySQL 5.5. on a Win7-64 bit O/S.

    Thanks in advance for any help anyone can offer.
    If everybody's thinking alike, somebody isn't thinking.

  2. #2
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,432
    My first thought is that it's good that you can't use any of the mysql_*() functions, because you really should Stop Using the MySQL Extension!.

    Either way, the php.ini file being read by PHP is going to enable (or not) whatever extensions you desire. So, if you're missing the functions provided by a certain extension, then you'll want to modify that php.ini file to enable the appropriate extension. Note you can do a phpinfo() to determine which php.ini file(s) (if any) PHP is using.

  3. #3
    Senior Member
    Join Date
    Aug 2002
    Location
    Florida Sun Coast
    Posts
    224

    Thanks for that feedback.

    I've made sure that the MySQL extensions are enabled in the php.ini file. But I still cannot call any functions. Php.info shows that MySQL is not enabled. Just how MS Studio could mess this up is beyond me, but it apparently did, as that is the only software I've installed since this issue began.

    As for using MySQLi, I don't follow you. Those are still calls to the same MySQL library, only using the new class definition, right? If I can't get PHP to find the MySQL library I'm not sure what good that would do. How can you use MySQLi calls if you can't access the library? But I like the idea of not having to fool around with setting up MySQL anymore, if that's possible.

    Last edited by bradgrafelman; 02-18-2013 at 07:54 PM.
    If everybody's thinking alike, somebody isn't thinking.

  4. #4
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,432
    Quote Originally Posted by Stinger51 View Post
    I've made sure that the MySQL extensions are enabled in the php.ini file.
    Apparently not, because as you've said:
    Quote Originally Posted by Stinger51 View Post
    Php.info shows that MySQL is not enabled.
    Have you verified that the php.ini file you're looking at is actually being parsed by PHP?

    Quote Originally Posted by Stinger51 View Post
    Those are still calls to the same MySQL library, only using the new class definition, right?
    Not necessarily, no.
    Quote Originally Posted by Stinger51 View Post
    If I can't get PHP to find the MySQL library I'm not sure what good that would do.
    PHP doesn't need the MySQL client library. The outdated mysql PHP extension initially needed it ("libmysql") - not PHP itself. Due to its many shortcomings, however, the "myqlnd" driver was developed (the "nd" suffix stands for "native driver", meaning it's native to PHP and doesn't require an external library to work).

    Quote Originally Posted by Stinger51 View Post
    How can you use MySQLi calls if you can't access the library?
    With mysqlnd, that's not an issue (because if you can't access mysqlnd - the native driver - that suggests you're not really accessing PHP at all).

    Quote Originally Posted by Stinger51 View Post
    But I like the idea of not having to fool around with setting up MySQL anymore, if that's possible.
    Not sure what you mean here; installing and configuring the MySQL server isn't (and never has been) a prerequisite for getting PHP to interface with MySQL. Now, if by "MySQL" you actually meant "the PHP extension to interface with MySQL", that's a whole different story. (Not typically a long one, either - the most I've ever had to do was uncomment "extension=php_mysqli.dll" in php.ini and call it a day).

  5. #5
    Senior Member
    Join Date
    Aug 2002
    Location
    Florida Sun Coast
    Posts
    224

    I re-installed WAMP 2.2 for Win7-64 and double checked the php.ini file and according to WAMP I do indeed have the extensions for MySQL enabled. But phpinfo() still showing MySQL is not enabled, only that MySQLND is enabled. Still, I cannot programmatically access any MySQL functionality. The new port (8080) I assigned in the Apache/conf file does work fine for WAMP (but XAMPP refuses to accept this port, keeps defaulting to port 80 no matter what) and at least allows me to access localhost:8080. But without MySQL access, further LAMP dev is at a standstill. The first call to mysql_connect() brings everything to a halt. Again, I can see my database from a 3rd party DBMS, so I know that port 3306 is working.

    I'm about ready to grab a new Win7 machine (forget 8, it's a mess) and dedicate it just for ASP.Net dev. Or I may see how far I can get with Ubuntu 12 on my current machine (dual boot) and LAMP dev. But that's a whole "other ballgame."

    If anybody out there knows how to get XAMPP to change port settings to something other than port 80 (and I've tried everything I can find) and make it stick, I will give XAMPP one more shot.

    Thanks for your input.

    Last edited by bradgrafelman; 02-19-2013 at 02:19 PM.
    If everybody's thinking alike, somebody isn't thinking.

  6. #6
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,432
    Quote Originally Posted by Stinger51 View Post
    I re-installed WAMP 2.2 for Win7-64 and double checked the php.ini file and according to WAMP I do indeed have the extensions for MySQL enabled. But phpinfo() still showing MySQL is not enabled, only that MySQLND is enabled. Still, I cannot programmatically access any MySQL functionality.
    Can you attach your php.ini file as well as the output of the phpinfo() (rename it to .txt so the forum allows you to upload it) so we can view both of them directly?

    Quote Originally Posted by Stinger51 View Post
    The new port (8080) I assigned in the Apache/conf file does work fine for WAMP (but XAMPP refuses to accept this port, keeps defaulting to port 80 no matter what)
    Neither "WAMP" nor "XAMPP" have any real bearing on the matter at hand. Those are simply collections of other software (Apache, MySQL, PHP, etc.) wrapped together and presented to those who are too lazy to actually set things up properly themselves. (At least, that's always been my view of them.) In the end, you're still just using Apache and PHP.

  7. #7
    Senior Member
    Join Date
    Aug 2002
    Location
    Florida Sun Coast
    Posts
    224

    PHP File attached

    Quote Originally Posted by bradgrafelman View Post
    Can you attach your php.ini file as well as the output of the phpinfo() (rename it to .txt so the forum allows you to upload it) so we can view both of them directly?

    Neither "WAMP" nor "XAMPP" have any real bearing on the matter at hand. Those are simply collections of other software (Apache, MySQL, PHP, etc.) wrapped together and presented to those who are too lazy to actually set things up properly themselves. (At least, that's always been my view of them.) In the end, you're still just using Apache and PHP.
    Yes, attached is the php.ini file as a text file. This file lives in the wamp\bin\apache\apache2.2.21\bin directory.

    I used to "roll my own" LAMP setup, but got lazy. Still, I learned a lot by that experience, especially when it came to getting the correct version of XDEBUG installed (a real nightmare, if there ever was one). And I see I will have to do this again for WAMP. I will probably just copy the lines from one file to the other, making sure the versions for XDEBUG are correct.

    Thanks in advance for any assistance you can provide.
    Attached Files Attached Files
    If everybody's thinking alike, somebody isn't thinking.

  8. #8
    Pedantic Curmudgeon Weedpacket's Avatar
    Join Date
    Aug 2002
    Location
    General Systems Vehicle "Thrilled To Be Here"
    Posts
    21,910
    Have you verified that the file is actually being read (i.e., that the "Loaded Configuration File" entry given by phpinfo() is correct?
    Quote Originally Posted by bradgrafelman
    Note you can do a phpinfo() to determine which php.ini file(s) (if any) PHP is using.
    THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER
    FAQs! FAQs! FAQs! Most forums have them!
    Search - Debugging 101 - Collected Solutions - General Guidelines - Getting help at all

  9. #9
    Senior Member
    Join Date
    Aug 2002
    Location
    Florida Sun Coast
    Posts
    224
    Quote Originally Posted by Weedpacket View Post
    Have you verified that the file is actually being read (i.e., that the "Loaded Configuration File" entry given by phpinfo() is correct?
    Yes. This is from the printout when I run phpinfo():

    Configuration File (php.ini) Path C:\Windows

    Loaded Configuration File C:\wamp\bin\apache\Apache2.2.21\bin\php.ini

    Scan this dir for additional .ini files (none)

    Additional .ini files parsed (none)


    When I installed the latest WAMP download this is how things got configured. I've been looking for resources that will demonstrate how to have PHP and MySQL talk to each other without bothering with this .ini file, but so far I haven't found any. That would be the ideal.
    If everybody's thinking alike, somebody isn't thinking.

  10. #10
    Pedantic Curmudgeon Weedpacket's Avatar
    Join Date
    Aug 2002
    Location
    General Systems Vehicle "Thrilled To Be Here"
    Posts
    21,910
    Quote Originally Posted by Stinger51
    how to have PHP and MySQL talk to each other without bothering with this .ini file
    Hmm. Just checking the Win7/Apache2.4.3/PHP5.4.11/MySQL5.5 installation here (it's not mine but it is using MySQL for its dbms) and the only MySQL interface enabled on it is PDO, not MySQL and not MySQLi.

    Just an an experiment I uncommented "extension=php_mysql.dll" and restarted the server.

    Yep, that's enough for the extension to be loaded and the function to exist ... so not much help there, I guess. A failure to load the extension would be reported as such.

    Huh. Turns out that Windows PHP loads mysqlnd even if you don't have any MySQL APIs enabled.... (At least in the official build, which is what I'm using - I don't know about third-party builds)

    But beyond the config settings in the "[MySQL]" section of php.ini (which won't be applying if the extension isn't enabled to begin with), neither PHP nor MySQL use the .ini file to "talk to each other". That's done using the standard socket mechanism - the .ini file is only needed if the MySQL server isn't listening on the traditional 3306 socket.
    Last edited by Weedpacket; 02-19-2013 at 10:03 PM.
    THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER
    FAQs! FAQs! FAQs! Most forums have them!
    Search - Debugging 101 - Collected Solutions - General Guidelines - Getting help at all

  11. #11
    Senior Member
    Join Date
    Aug 2002
    Location
    Florida Sun Coast
    Posts
    224
    Yes, the older php.ini file had the MySQL extensions enabled by default, for sure, as I always recall see those when running phpinfo(). I did find it curious that some sort of change has been made. But as you stated, we should not be using this approach anymore.

    Now I am wondering about sockets. I don't understand this topic very well, never paid very much attention to it. But is it possible that the ASP.Net installation did something to overwrite this (these) settings? Something is starting to smell fishy to me. As I also mentioned, I did not have this "issue" until a few days ago when I installed Microsoft's Visual Web Developer 2010 Express package. And for sure, this package is hogging port 80. I have to think that somehow knocking out my config for MySQL is related to this. I just can't understand how.

    Well, without any obstacles to overcome (even if man made, and this is all surely man made) how else can we learn here? So, thanks for bearing with me here. I am certain at the end of this "trial" everybody paying attention here or reading here will have learned something.
    If everybody's thinking alike, somebody isn't thinking.

  12. #12
    Pedantic Curmudgeon Weedpacket's Avatar
    Join Date
    Aug 2002
    Location
    General Systems Vehicle "Thrilled To Be Here"
    Posts
    21,910
    Quote Originally Posted by Stinger51
    Now I am wondering about sockets.
    I should have said "ports". I was thinking of the Berkeley Sockets implementation of the transport (since it's basically the IP port model adapted so that it can also be used between processes on a single host. "Socket" refers to the whole "hostort" address - PHP sends a message to MySQL by addressing it to "127.0.0.1:3306" (or whatever the host and port are configured as) - like in snail mail where the address written on the envelope includes the name of the recipient as well as the destination).

    If you run PHP from the command line, what does phpinfo() say then?
    Last edited by Weedpacket; 02-20-2013 at 05:14 AM.
    THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER
    FAQs! FAQs! FAQs! Most forums have them!
    Search - Debugging 101 - Collected Solutions - General Guidelines - Getting help at all

  13. #13
    Member
    Join Date
    Nov 2006
    Posts
    66
    Leave Apache alone, and try changing the IIS port: http://support.microsoft.com/kb/149605

    Also, have you been restarting Apache as you adjust the php.ini settings? If you can make changes to the php.ini file, but those changes are never reflected in the phpinfo() output, you've got 1 of 2 problems: 1) you're forgetting to restart Apache after making changes OR 2) Apache is looking at a different php.ini file

  14. #14
    Senior Member
    Join Date
    Aug 2002
    Location
    Florida Sun Coast
    Posts
    224
    It's been so long since I did anything from the command line in Windows I forgot the syntax. I motored on over to the wamp\www directory and I tried this from the command prompt (brackets [ ] used here instead of < > to preserve formatting here):

    [?php phpinfo.php; ?]

    but Windows just complains that the command syntax is incorrect. Sorry, but my VAX/VMS like command line skills are long gone. I take it that if phpinfo (from the command line) shows nothing about MySQL this is another issue? Help, please.
    If everybody's thinking alike, somebody isn't thinking.

  15. #15
    Senior Member
    Join Date
    Aug 2002
    Location
    Florida Sun Coast
    Posts
    224
    Thanks for that link. I am loathe to touch anything in the Windows registry (since I blew it up once awhile back), but will make a backup copy and see what I can do here. I tried to fathom the article the link pointed to, but it's mostly beyond my depth of understanding. But I believe you are correct, that this issue points to the server that the Windows package set up for me to use ASP.Net dev. It is somehow interfering with MySQL and the WAMP server I'm running.

    Per Apache, yes, I've even cold booted the machine I'm on after making sure the extension=php_mysql.dll lines are uncommented. And WAMP reports that it is using the correct php.ini file:

    C:\wamp\bin\apache\Apache2.2.21\bin\php.ini
    If everybody's thinking alike, somebody isn't thinking.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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