|In PHP 5, MySQL is no longer enabled by default, nor is the MySQL library bundled with PHP. Read this FAQ for details on why. Because of this, Windows users will need to enable php_mysql.dll inside of php.ini and either copy libmysql.dll into the Windows system directory or make it available to the PATH. For compiling, simply use --with-mysql=[DIR] where [DIR] points to your MySQL installation directory. |
I've done everything but
"For compiling, simply use --with-mysql=[DIR] where [DIR] points to your MySQL installation directory."
I don't know what this means :(
it means the directory in which mysql is located.
You are running Windows so you more than likely did not compile PHP but are running PHP from a binary installation. Did you uncomment the MySQL extension yet in your php.ini file?
See step 6 in message #2 in Installing PHP5 Unders Windows XP and Apache [webmasterworld.com].
I know what the [DIR] means, I am saying I don't know how to compile PHP on a windows machine.
I have uncommented all the extensions I wish to use, and I am not getting any errors that apache/php can't find anything(meaning I have the .dlls in the correct spot). It just doesn't know what the mysql functions are....
Any help would be appreciated. The php installation works fine otherwise, I've used basic php functions for, time, date, info... etc. They all work great, it just doesn't know where the functions for mysql are.
*edited for spelling/grammer*
let's take a step back and have a look at what's going on here.
>> I am not getting any errors that apache/php can't find anything
actually that's not true, you are getting an error that there is an undefined function, which means php can't find something.
>> I've used basic php functions
so we know that php is where it needs to be
>> I have the .dlls in the correct spot
so we know, and hopefully have checked a bunch of times ;), that the dll's are in the right spot.
So, the way I see it everything seems to be in the right spot except there seems to still be confusion. So how could everything be in the right spot yet php can't find it? First think how does php/apache find things?
>> I have uncommented all the extensions I wish to use
ok, but, something is still wrong
do you have only a single php.ini? (I have heard this problem many, many times on windows installs)
are you positive you are editing the one apache is using?
delete or rename the one you are editing and see if it still runs as is
I did a complete search of my machine to find all occurences of php.ini files. I found 1 php.ini, and the php.ini_old file that I created when I was trying to debug this problem, also found the php.ini-default files or whatever the php distribution ships with.
I'm going to go back to the very beginning and clean everything up, and configure it all again using the walk through.... who cares if I figure out what's wrong, I just want the damn thing to work :P
I'll report back asap.
and yes, I should correct myself. PHP and Apache aren't reporting any errors in finding the actually .dll files, I didn't mean it can't find functions(which I am assuming are in one of those .dll files it DOES find....)
I don't know what's going on.
it's giving me the same freaking crap....
anyone know where the mysql_connect() function is defined in php? is it in one of those dlls and maybe it just doesn't have it in there? I'm lost.
I've moved the php.ini file to the Apache2 root dir(default apache2 install) and the phpinfo() still says it's in C:\Windows, yet I've got show hidden and system files there, and it's not there. I also went into th command prompt and looked for it there(just in case it wasn't showing up in the Windows GUI) and it isn't there.
Why would phpinfo() be saying it's using the php.ini file in C:\Windows when there isn't one there? Is it because that is where I first put the file?
Note** I have restarted apache and the computer multiple times
I have a setup almost exactly like yours, the main difference being I DO NOT have XP Service Pack 2 installed, and I just...
- Ran phpinfo().
- The Configuration File (php.ini) Path states C:\WINDOWS\php.ini
- Stopped Apache.
- Moved my php.ini from C:\WINDOWS\ to C:\Program Files\Apache Group\Apache2\
- Started Apache
- Ran phpinfo() again.
- Configuration File (php.ini) Path states C:\Program Files\Apache Group\Apache2\
Therefore, I would venture to guess that if phpinfo() is telling you it found the php.ini file in a certain path, then it found it in that path. If you are using MS Internet Explorer for the browser, clear the cache and try again. If phpinfo() tells you that it found the file there, I'm guessing it found the file there. Try what jatar_k mentioned earlier, try renaming the only php.ini file you have to something like php.bak and stop and restart apache, and call phpinfo() again. If it works, then it is indeed finding the php.ini file somewhere else and you'll have to track it down.
It runs without the php.ini file.... now how can I tell where it is?
I've went through command to look for it, it's not viewable through windows explorer...
OK, I just renamed my php.ini as well and stopped and restarted Apache. There is absolutely no php.ini file on my system anywhere. Apache will start without error, and phpinfo() WILL indeed run, but searching down through the directives, I find absolutely zero reference to MYSQL, therefore the extension is not loading. The Configuration File (php.ini) Path still shows C:\WINDOWS though and I don't know why -- I would have to research this, and maybe it's a bug or perhaps it's an internal thing. Either way, it is a bit deceptive.
<edit> C:\WINDOWS, not C:\WINDOWS\php.ini! Yes, the C:\WINDOWS directory is the last path being searched and it didn't find any php.ini file there, so this is a correct identification.
OK, time out. I just realized that it says
Either way, all I have to do is copy my php.ini file with my extensions uncommented back into the C:\WINDOWS directory, stop apache, start apache, and I'm back on track.
[edited by: coopster at 2:47 pm (utc) on Sep. 30, 2004]
The best I can find regarding the how/why of php.ini during startup is on the Configuration [php.net] page and the FAQ [php.net] link from there.
One other thing that is coming to mind as I read those pages though is that you should also make sure you don't have a php-SAPI.ini file laying around somewhere.
tell me this:
put your php.ini file in your apache2 directory and restart apache, and tell me if that changes your config location to apache2 directory....(edit DOH, you already did this....)
on mine, it doesn't change the install directory, but the FAQ link you gave says it looks in apache2 directory first, then goes out to the windows directory....
Mine doesn't change(whether it actually looks in different spots I can't be certain.).
What should I try next?....
Did you also make sure you don't have a php-SAPI.ini file laying around somewhere?
BING, something a friend found for me....
it doesn't help the situation much, but at least I'm not alone.
It really only says that the person having the problem went the cgi instead of the module way.
maybe I should try that :( I really think the module way is what I want.
[edited by: coopster at 4:13 pm (utc) on Sep. 30, 2004]
[edit reason] fixed sidescroll [/edit]
>>went the cgi instead of the module way
What do you have in Apache ( httpd.conf ) for your PHP configuration settings?
By the way, I found what I was looking for earlier...
PHP searches for php.ini in the following locations (in order):
- PHPIniDir directive (Apache 2 module only)
- The PHPRC environment variable
- Directory of PHP (for CLI), or the web server's directory (for SAPI modules)
- Windows directory (C:\windows or C:\winnt)
What I did....
In one of the tutorials that I read it told me to edit the PHPIniDir = "C:\PHP"
I've changed this back to "./" and it's now reading the apache directory for php.ini and loading the settings in there
Thanks for getting me on the right track.
I'm getting more errors now, but they are different, it's "seeing" the mysql functions now, now I have to configure mysql properly :)
>>In one of the tutorials that I read it told me to edit the PHPIniDir = "C:\PHP"
The example in the PHP Apache 2.0.x on Microsoft Windows [php.net] installation instructions is probably where you came across that directive and it's example setting. But you didn't change it to reflect the correct path to your php.ini file ;)
Glad you got it.
yes, very silly mistake... the real problem though, is phpinfo() telling me it's reading the php.ini file from the C:\windows directory when infact,it was reading from the C:\php directory, not finding anything and initializing defaults....
I personally, would like to see php bomb out and say "Hey stupid, there is no php.ini file for me to read, where you said it was!"
would make troubleshooting this sort of problem alot easier :P