Unable to connect to MySQL using PHP on Windows7

Unable to connect to MySQL using PHP on Windows7  #angularjs #reactjs

  • httpd-userdir.conf.in to c:/Apache24/conf/original/extra/httpd-userdir.conf Rewrote docs/conf/extra/httpd-mpm.conf.in to c:/Apache24/conf/original/extra/httpd-mpm.conf Rewrote docs/conf/httpd.conf.in to c:/Apache24/conf/original/httpd.conf Rewrote docs/conf/extra/proxy-html.conf.in to c:/Apache24/conf/original/extra/proxy-html.conf Rewrote docs/conf/extra/httpd-vhosts.conf.in to c:/Apache24/conf/original/extra/httpd-vhosts.conf Rewrote docs/conf/extra/httpd-dav.conf.in to c:/Apache24/conf/original/extra/httpd-dav.conf Rewrote docs/conf/extra/httpd-languages.conf.in to c:/Apache24/conf/original/extra/httpd-languages.conf Rewrote docs/conf/extra/httpd-manual.conf.in to c:/Apache24/conf/original/extra/
  • The better solution is to upgrade your PHP code so that it does not use the deprecated mysql_connect , mysql_query and other related legacy mysql functions.
  • “to something earlier than 7.0” – The OP’s PHP version is 5.6.29 – Fred -ii- 6 mins ago
  • You could change the PHP version in your WAMP installation to something earlier than 7.0 by adjusting the version it’s using in the settings in the toolbar.
  • Depending on the size of your code, this could be a short or lengthy process.

I have manually set up a wamp Server on Windows7 with Apache 2.4.23, PHP 5.6.29 and MYSQL Server 5.5. Each time I try to connect to MySQL I get the error:

@ng_real_ninja: Unable to connect to MySQL using PHP on Windows7 #angularjs #reactjs

I have manually set up a wamp Server on Windows7 with Apache 2.4.23, PHP 5.6.29 and MYSQL Server 5.5. Each time I try to connect to MySQL I get the error:

I have tried the following stackoverflow solution,but I could not find any libmysql.dll in c:\PHP nor copying php_mysql.dll from c:\PHP to C:\Windows\System32 was fruitful: Call to undefined function mysql_connect

: https://jsfiddle.net/ad0gd90y/

I have also viewed the error log file in Apache:

I am totally helpless as how to solve this problem. Also what is libmysql.dll used for? Is there any installation order to get it all right(I installed apache followed by php and mysql at last)? Thanks in advance!

Most likely you’re copying code from an older site to a newer version of PHP. The code

is deprecated in PHP 5.5 and removed in PHP 7.0.

I’ll post solutions in a minute.

You could change the PHP version in your WAMP installation to something earlier than 7.0 by adjusting the version it’s using in the settings in the toolbar.

and other related legacy mysql functions. Depending on the size of your code, this could be a short or lengthy process. However, it’s important to consider doing this because the older

functions have several security vulnerabilities, such as SQL injection, and your website may be vulnerable to hacking attacks if you don’t take the time to upgrade your code.

Unable to connect to MySQL using PHP on Windows7

You might also like More from author

Comments are closed, but trackbacks and pingbacks are open.