A little background for context: I'm pretty new to programming and such, and I have been trying for the past few months to set up a development environment on my laptop so I can practice with some basic stuff--PHP, Javascript, MySQL, possibly Python in the near future--and I have spent the past few months, off-and-on, trying to set up this environment with mixed results. I installed Apache 2.2, PHP 5.4.30, and MySQL 5.6 and have been tinkering with it the past couple nights trying to figure out on my own why a few things aren't working.
Right now my issue is this:
I'm trying to put together some basic pages on my localhost that will use HTML and PHP to connect to MySQL to enter things into a database with an HTML form page. The HTML works fine, obviously, but the PHP doesn't seem to want to play with MySQL. I keep getting error messages saying things like this:
Fatal error: Call to undefined function mysql_connect() in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\MtG_DB_files\browse.php on line 24.
The relevant lines on the script I'm writing are as follows:
$host="localhost";
$user="XXXXX";
$password="YYYYY";
$dbname="mtg";
/*$cxn=mysql_connect($host,$user,$password,$dbname)or die("Not connecting!");*/
$cxn=mysql_connect("localhost","XXXXX","YYYYY","mtg")or die("Failed to connect to MySQL");
mysql_select_db($cxn,"cardscatalog")or die("Failed to connect to Cards Catalog");
Half of me thinks my problem is syntax and the other thinks the problem is some kind of installation error. This all worked fine when I was initially learning it in grad school and using the school's servers and their installations of everything, so I have been able to do it in the past, I just have to figure out what I installed wrong on my personal laptop and how. I know this is a common problem and I've searched around the Internet trying to find a solution.
So far I've tried:
- Checking to make sure my dll files in php.ini are there and uncommented
- Making sure the php.ini file is reading from the right location
- Updating my versions of PHP, Apache, and MySQL (all are currently the versions I indicated previously) and double-checking that they're the right versions
- Making sure the right dll files are in the right locations (php_mysql.dll and php_mysqli.dll are in C:\php\ext)
- I've been obsessively restarting Apache and MySQL whenever I make changes
- I made sure Apache had read/write access to the access.log file, after reading about that on another site.
- Out of desperation, I remembered that in my grad school projects, once or twice something would work in IE but not Chrome or vice versa, so I've tried using both browsers to view the pages I'm creating. No dice.
What else can I do or try? I've got to be coming at this from the wrong angle. Is there some kind of updated or unincluded file(s) I should download? Please let me know of any specs I should include or any additional info needed to help figure this out; as you can see, I'm quite new to this and really don't know what I'm doing. On a related note, please be specific and fairly idiot-proof if you care to respond...I'm not joking when I say I'm a noob and I don't really speak the jargon and such.;-)Thank you for your time!
EDIT--7/15/14 00:13am Adding a link to my php.ini file for clarification.
EDIT--7/15/14 23:37pm I'm wondering if this part of my phpinfo gives any useful information:
Path C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Sony\VAIO Startup Setting Tool;C:\Users\XXXXXX\AppData\Local\Smartbar\Application\;C:\Users\Marisa\AppData\Local\Smartbar\Application\;C:\Program Files\jEdit;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\MySQL\MySQL Utilities 1.4.3\;C:\Program Files (x86)\MySQL\MySQL Utilities 1.4.3\Doctrine extensions for PHP\
PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
EDIT--7/16/14 10:33 Well I tried re-installing PHP and MySQL last night and nothing doing--no perceptible change in the errors I've been getting. I think what might be affecting the problem is that a few of my extensions might have been from older versions of PHP and MySQL I tried to install, so I updated php_mysqli.dll, php_mysql.dll, and php_mbstring.dll, and put them in C:\php\ext and C:\Windows (covering my bases by using both locations), but I discovered I don't appear to have a libmysql.dll file anywhere in the places I thought it might be! I've done a little Googling around and it looks like people recommend against downloading a separate libmysql.dll file...what might be a good way to solve this?