logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: Huge Hint for those who can't get MySQL to work with PHP
Author
Matt Grdinic



Joined: 08 Nov 2006
Posts: 3
Location: Wisconsin

PostPosted: Wed 08 Nov '06 4:15    Post subject: Huge Hint for those who can't get MySQL to work with PHP Reply with quote

Right, so I was going out of my mind trying to get Apache 2.2.3/PHP5.1.6 and MySQL 5.0.27 to play nice together. Bottom line, I couldn't get Apache to 'see' any of my PHP extensions, among them mysql.dll. This was a real killer because PHP worked just fine from the command line, including talking to mysql.

Anyway, it turnes out what was killing my rig was including the
PHPIniDir C:/php
line in the appache config file.

I know, crazy, but it was killing things. I think the reason is I added c:\php to my system path, and this double naming of a path variable and the PHPInDir directive was somehow wrecking havoc.

Any comments about this from anyone?
Back to top
pnllan



Joined: 05 Dec 2005
Posts: 221

PostPosted: Wed 08 Nov '06 9:45    Post subject: Reply with quote

Wow, that's weird but if you have it working that is what counts. I have the PHPIniDir directive and the PHP folder in my environment path without ANY issues - yes I use MySQL too.

Out of curiosity, which of the below two statements most closely represents what you had in your httpd.conf?:

1) PHPIniDir C:/php

or

2) PHPIniDir "C:/php"

The reason I ask is because you write in your post - PHPIniDir C:/php. Which would be incorrect on a Windows system, since Apache on Windows requires that paths be quoted (" ").

If you are quoting your path for PHPIniDir, then you definitely have something strange going on.
Back to top
Matt Grdinic



Joined: 08 Nov 2006
Posts: 3
Location: Wisconsin

PostPosted: Fri 10 Nov '06 2:30    Post subject: Reply with quote

I appreciate your input. That said, both ways break it. That is, quoted and unquoted. The only way it works is by uncommenting the whole line.

At work I'm stuck with IIS and SQL Server 2005, yet I've muscled in PHP as our primary scripting language. Problem is IIS does not play nice with PHP at all when it comes to performance, so this Apache avenue is very appealing to me as a potential solution.

I would like to come to some type of resolution with this issue, because installing in an enterprise environment with this type of stuff going on is not going to be pretty at all.

Anyway, I think it's also important to mention that NO extensions load with that line active. MySQL is just the one I've got a need for right now. So for example, GD doesn't load either.
Back to top
pnllan



Joined: 05 Dec 2005
Posts: 221

PostPosted: Fri 10 Nov '06 7:05    Post subject: Reply with quote

I don't know everything you have going on your system(s) or how you installed and configured your setup, but where I work we have NUMEROUS Apache/PHP/MySQL servers running on Windows platforms without ANY of the issues you describe. So, it's not anything with the PHPIniDir directive since we use on all our configurations. Here's a fairly detailed description of how we do it:

http://www.apachelounge.com/viewtopic.php?t=570

Also, note the source we use for Apache and the PHP handler. While I state in that tutorial to use Steffen's compilation, we build and compile our own which is nearly identical to what can be downloaded here. The reason for building our own or using what Steffen offers is that PHP.net did not develop an Apache handler for PHP 5.1.x that would work on Apache 2.2.x. However, now that PHP 5.2 has been released, you can use the ASF and PHP.net compilations without any issues.
Back to top
Mitron



Joined: 04 Jan 2006
Posts: 63

PostPosted: Fri 10 Nov '06 11:22    Post subject: Reply with quote

Hmm, you said PHP 5.1.6 and MySQL 5.0.27? How are you getting those two to talk to each other without the PHP Connector? I know mysql.com has the PHP Connector for 5.1.6 and MySQL 5.0.26, but not 5.0.27.

Also, I don't seem to notice a problem with performance issues on IIS with PHP either, although I don't run the CGI version.

I also run Apache 2.2.3/PHP 5.1.6, but I've stuck with MySQL 5.0.26 until they release the PHP Connector for 5.0.27. This is also keeping me from going to PHP 5.2.0.

I've also setup PHP 5.1.6 on numerous IIS machines without issue although I haven't played much with SQL Server 2005, most clients opt for MySQL instead. Smile
Back to top
Matt Grdinic



Joined: 08 Nov 2006
Posts: 3
Location: Wisconsin

PostPosted: Mon 13 Nov '06 5:00    Post subject: Reply with quote

Mitron wrote:
Hmm, you said PHP 5.1.6 and MySQL 5.0.27? How are you getting those two to talk to each other without the PHP Connector? I know mysql.com has the PHP Connector for 5.1.6 and MySQL 5.0.26, but not 5.0.27.

I am in fact using the php5apache2.dll. by Steffen. Good suggestion though.

Mitron wrote:

Also, I don't seem to notice a problem with performance issues on IIS with PHP either, although I don't run the CGI version.

Their is most certainly a performance problem. The good thing is something is finally being done about it:
http://www.zend.com/products/zend_core/windows_preview/

I feel very positive about this news. In our production environment we actually call .NET procedures to display images from our database over PHP. The sad thing is at first I wrote code to do it with PHP, but in the end it was too damn slow.

We actually have IP's set up with both versions. One running PHP/IIS/SQLServer, the other fully .NET. I'll try and post those IP's tomorrow so you can see the dramatic difference for yourselves.

The good news is Apache/PHP/SQL is much faster, on par with the .NET version, but in our office the manager simply refuses to use Apache.

On a related note, I did some poking around and saw the php5apache.dll file was in my c:\php\ directory. Could that be a problem?
Back to top
Mitron



Joined: 04 Jan 2006
Posts: 63

PostPosted: Wed 15 Nov '06 4:48    Post subject: Reply with quote

Matt Grdinic wrote:

I am in fact using the php5apache2.dll. by Steffen. Good suggestion though.


I'm pretty sure that's different. Steffen may be able to correct me here, but the php5apache2.dll has to do with Apache 2.2.3 and PHP 5.1.6, but has nothing to do with the PHP 5.1.6 and MySQL 5.0.27 connector, which is a combination of the following files:

libmysql.dll
php_mysql.dll

and/or

php_mysqli.dll

However, MySQL has only released the connector for PHP 5.1.6 and MySQL 5.0.26. While this one may also work for MySQL 5.0.27, you may discover issues because of the differences. I know I did trying to use an older connector with 5.0.19.

Matt Grdinic wrote:

On a related note, I did some poking around and saw the php5apache.dll file was in my c:\php\ directory. Could that be a problem?


I wouldn't think so, as long as that path is defined in your System Variables and the ini files you should be fine. Smile
Back to top


Reply to topic   Topic: Huge Hint for those who can't get MySQL to work with PHP View previous topic :: View next topic
Post new topic   Forum Index -> Other Software