Solved

can't get iis7 & php to connect to mysql server

Posted on 2011-03-03
8
756 Views
Last Modified: 2012-05-11
scenario:

Windows 2008 (32bit) server
php 5.3.5
iis 7
php is working
mysql is located on another server
mysql extensions are uncommented in the php.ini config file.  

problem:
My web server won't connect to the mysql server.

Fatal error: Call to undefined function mysql_connect()

I've copied the libmysql.dll from the old server and copied it to c:\php & c:\php\ext & the system32 directories.  no luck.  

I created a test file that runs .....


<pre><?php echo function_exists('mysql_connect') ? 'YES' : 'NO';
print_r(get_defined_functions()); ?></pre>

and it returns no mysql functions at all.

Thanks in advance for the help/
0
Comment
Question by:cewi
8 Comments
 
LVL 39

Expert Comment

by:Aaron Tomosky
ID: 35032198
If you can't get it to work, try adodb. I use it for everything.
0
 
LVL 2

Expert Comment

by:garrett_boarder
ID: 35032252
You may have to allow MySQL connections from another IP in MySQL config.  I am guessing it is just localhost by default for security reasons.
0
 

Author Comment

by:cewi
ID: 35032283
the mysql server is setup to accept connections.  I have another site that connects to it (coldfusion) and I also tried to connect the php site to the old sql server which i knows works.  

mysql_connect should be a predefined function in php.  is it not on my server.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 39

Expert Comment

by:Aaron Tomosky
ID: 35032533
0
 

Author Comment

by:cewi
ID: 35032570
thanks for the info but that is a tutorial with vista, php 5.1, and mysql installed locally.  that is not my setup.  i've already followed several setup guides for my scenario.
0
 
LVL 109

Expert Comment

by:Ray Paseur
ID: 35033280
When you run the phpinfo() function do you see that MySQL is installed?  IIRC it is a separate installation, not part of the PHP core.
0
 

Accepted Solution

by:
cewi earned 0 total points
ID: 35180491
I figured out the problem (somewhat).  The config file was pointing to the correct extensions directory however phpinfo showed it was pointing to the root of the php folder and i couldn't change it.  After a uninstall and re-install it is working correctly. thanks
0
 

Author Closing Comment

by:cewi
ID: 35221132
I am giving the grade of B b/c I couldn't figure out the cause of PHP defaulting the extensions directory.  It had to be fixed with a reinstall.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating and Managing Databases with phpMyAdmin in cPanel.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question