Call to undefined function mysql_connect windows
I just installed PHP and Apache on my home PC. When I try to call function
I have loaded php.ini where I have uncommented lines Output of phpinfo(): http://jsfiddle.net/MMTwA/
asked Dec 18, 2011 at 11:28
11 After looking at your Also, you should check your Apache logs for errors (should be in the \logs\ directory in your Apache install. If you haven't read the below, I would take a look at the comments section, because it seems like a lot of people experience quirks with setting this up. A few commenters offer solutions they used to get it working. http://php.net/manual/en/install.windows.extensions.php Another common solution seems to be to copy libmysql.dll and php_mysql.dll from c:\PHP to C:\Windows\System32. answered Dec 18, 2011 at 13:51
BryanBryan 2,16520 silver badges28 bronze badges 3 Background about my (similar) problem: I was asked to fix a PHP project, which made use of short tags. My WAMP server's PHP.ini had PROBLEM Surfaced: Immediately after this change, all my mysql_connect() calls failed. It threw an error
Solution: Simply set answered Dec 28, 2011 at 12:07
DrigsDrigs 716 bronze badges My PC is running Windows 7 (Apache 2.2 & PHP 5.2.17 & MySQL 5.0.51a), the syntax in the file "httpd.conf" (C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\httpd.conf) was sensitive to slashes. You can check if "php.ini" is read from the right directory. Just type in your browser "localhost/index.php". The code of index.php is the following: There is the row (not far from the top) called "Loaded Configuration File". So, if there is nothing added, then the problem could be that your "php.ini" is not read, even you uncommented (extension=php_mysql.dll and extension=php_mysqli.dll). So, in order to make it work I did the following step. I needed to change from
to
Pay the attention that the last slash disturbed everything! Now the row "Loaded Configuration File" gets "C:\PHP\php.ini" after refreshing "localhost/index.php" (before I restarted Apache2.2) as well as mysql block is there. MySQL and PHP are working together! answered Sep 18, 2013 at 11:36
0 You have probably forgotten to restart apache/wamp/xamp/whatever webserver you use, you need to do that in order to make it work answered Dec 18, 2011 at 11:31
Martin.Martin. 10.3k3 gold badges40 silver badges67 bronze badges 0 Check
your php.ini, I'm using Apache2.2 + php 5.3. and I had the same problem and after modify the php.ini in order to set the libraries directory of PHP, it worked correctly. The problem is the default The default (and WRONG) value for my work enviroment is
without any full path and commented with a semicolon. There are two solution that worked fine for me. 1.- Including this line at php.ini file
Where X: is your drive letter instalation (normally C: or D: ) 2.- You can try to simply uncomment, deleting semicolon. Include the next line at php.ini file
Both ways worked fine for me but choose yours. Don't forget restart Apache before try again. I hope this help you. answered Oct 4, 2014 at 22:17
1 Hi I got this error because I left out the ampersand (&) in
answered Jul 14, 2013 at 10:56
zzapperzzapper 4,5535 gold badges47 silver badges44 bronze badges Be sure you edited php.ini in /php folder, I lost all day to detect error and finally I found I edited php.ini in wrong location. answered Jul 14, 2015 at 9:09
nobjta_9x_tqnobjta_9x_tq 1,12513 silver badges16 bronze badges After change our php.ini, make sure to restart Apache web server. answered Feb 8, 2014 at 16:25
user2618844user2618844 3523 silver badges12 bronze badges Just for future reference, copying all these extension files to Windows/System or Windows/System32 is unnecessary. All that is required is a copy of the php.ini file you edit in the PHP dir to copied to the root Windows dir. phpinfo will clearly explain the below: Configuration File (php.ini) Path C:\Windows Logical sense will explain that php wants to load a config located in the Windows dir. :-) answered May 30, 2015 at 0:37
One time I had a problem while using
If you are in Windows, right click My Computer, select properties, and navigate to the Advanced tab... (is Windows 7). Click on Advanced system settings first then select the Advanced tab and then Environmental variables. Select PATH and click on Edit. Make a copy of the string in a .txt file for back up (it might be empty)--- set your environmental variables... Log out and log back in.
answered Apr 20, 2013 at 6:28
Since mysql_connect This extension was deprecated in PHP 5.5.0, and it was removed in PHP 7.0.0. Instead, the MySQLi or PDO_MySQL extension should be used. by default xampp does not load it automatically in your php.ini file you should uncomment
to
Then restart your apache you should be fine answered Mar 8, 2016 at 18:04
PascalPascal 2,3193 gold badges23 silver badges39 bronze badges 1 This same problem drove me nuts (Windows 10, Apache 2.4, MySql 5.7). For some reason (likely PATH related), the .dlls would not load after uncommenting the correct exension dlls and extension_dir = "ext" in php.ini. After trying numerous things, I simply changed "ext" to use the full directory path. For example. extension_dir = "c:/phpinstall/ext" and it worked. answered Jan 14, 2017 at 21:58
I think that you should use mysqli_connect instead of mysql_connect answered Jun 12, 2016 at 16:11
2 |