Forum Moderators: coopster
I got PHP 5 up and running.
I got MySQL 4.1 up and running.
However, I can't seem to get my scripts to access the MySQL database. When I call any type of MySQL function, I receive a php fatal error that the function does not exist.
I have read a lot about this and it appears that as of php 5, it does not support the new MySQL by default. And to have it do this, I need to uncomment the extension for the MySQL.dll in the php.ini file. I have done this, but still can't get anything to work.
Has anyone here come across this and is there anything else I can try?
Thanks so much!
I have tried both of your suggestions with the same results.
I have copied the php_mysql.dll from the php/ext/ directory to the winnt/system32/ directory as well as the libmysql.dll from the php/ directory to the winnt/system32 and I still can't use any mysql functions in my scripts.
I have tried copying these files seperately and together.
Thanks, but I'm running IIS. I have stopped and restarted the web service a number of times during the process of moving and editing different files. I have tried all the suggestions and went through the information jatar_k sent me to through the above link and I cannot seem to get PHP to recognize any MySQL functions.
In fact, when I run the phpinfo, there isn’t even a MySQL section. I have searched for multiple php.ini files and can only fine one on my machine. It is in the c:\php folder. phpinfo says it is in the C:\WINNT folder, but I know this is not correct. And here is something strange. I renamed my php.ini file to php-old.ini and php still ran fine. Should I restart my web service after changing the name? If not, then doesn’t that mean there has to be another php.ini file somewhere? If there is, I cannot find it anywhere.
I was able to install PHP 4.3.3 and MySQL 4.0 on my machine at work a few months ago and everything runs smoothly using IIS 5.1 under Windows XP Pro. I wanted to get the new stuff set up at home and everything is running well, except PHP will not recognize MySQL functions…
That WOULD explain all the problems you're having. If you're uncommenting the mysql extension in an ini file that PHP isn't using... See? :P
I start from scratch
rip every file having anything to do with php/mysql out of the machine, delete them for all eternity and then start the process from square one. I find I miss a small step and it is often easier to start over than it is to try and fix it.
Something of interest: I did notice that my version here at work states that the Configuration File (php.ini) Path is C:\WINDOWS\php.ini. It lists the actual ini file while at home it is C:\WINNT. It does not list the ini file, just the directory.
I tried moving the ini file from my C:\PHP directory to my C:\WINNT, Stopped and Started my Web Service and php ran but again without any MySQL support. Do I need to completely reboot my machine any time I move or make changes to the php.ini file before they will take effect? I though just stopping and starting the web service would be enough.
Oh, I also added C:\PHP to my Path system variable, so I would think I wouldn't even need to move my php.ini file from C:\PHP to C:\WINNT, but at this point I'm ready to try any combination of things.
I have NO System Environment Path variable for PHP.
I have NO php.ini file anywhere but in the C:\WINDOWS directory.
I pulled up phpinfo() and it said my file was located at:
C:\WINDOWS\php.ini
I went to the windows directory and renamed this file to php.ini.old
I then stopped and restarted the webservice.
Looking at phpinfo() again revealed that php did still work, but now my location was saying:
C:\WINDOWS
No php.ini file was listed. So, how is it running? This would make since why MySQL would not be supported if I am editing a file that the system is not reading (as StormFX stated), but where would it be? Is there some type of default file that gets php running that is maybe named something else?
Thanks again for all the help. If anyone can shed more light, I would be grateful.
That will make PHP look for everything BUT the two mysql extensions IN the PHP directory. Just make sure to create a PHP.ini file in the PHP directory ;)
Thanks for the information. I have had both C:\PHP and C:\MySQL\bin in the Path Environment Variable this entire time now.
With that in place, and my php.ini file in the C:\PHP directory, PHP and MySQL ran fine, but MySQL extensions were not being recognized and phpinfo was telling me the file was located in the C:\WINNT folder...
NOW... I tried something more...
I noticed that the php install instructions state the following:
"If you are running Apache 2, the simpler option is to use the PHPIniDir directive (read the installation on Apache 2 page), otherwise your best option is to set the PHPRC environment variable. This process is explained in the following FAQ entry. "
I noticed I had originally put in the PHPRC environment variable, but later removed it because I thought the C:\PHP in the Path variable would be enough...
Well, it sounds like the C:\PHP in the path directory is to locate the php5ts.dll file and the PHPRC variable is so php can locate the php.ini file. Regardless, I added it. After rebooting my system, now I get that "the page cannot be found" when I load up any php pages.
Any ideas? Sorry about the continual posts, but I would really like to get this resolved and am at my wits end.
Thanks again.
I don't use apache, as I've managed to tweak IIS to a lot of the functionality that apache boasts :). But I would change whatever you changed before you rebooted back to what it was before and see if that's the problem - as a first step.
At this point, I'd scrap all the installs, delete related files and start over :)
1. Install MySQL.
2. Unpack PHP, edit the PHP.ini and keep it in the PHP folder.
3. Copy the two required files (php_mysql[i] and the other file) to win/system32
4. Add the PHP to env path variable.
5. Add the app mapping.
6. Reboot.
Works for me :)
Troubleshooting Steps for PHP/Apache on windows [webmasterworld.com]. Although Apache is mentioned in the title here, it really applies to how your installation finds the php.ini configuration and has some troubleshooting steps for MySQL as well.
Another gotcha that a lot of folks run into shortly after getting the configuration correct is the known MySQL password issue [webmasterworld.com].
Just a couple of extra troubleshooting threads for ya ...
I found out that if your phpinfo() is displaying only the C:\WINDOWS or C:\WINNT as your configuration file as opposed to C:\WINNT\php.ini it does in fact mean that the php.ini file is not being found. How php still runs is beyond me, but this does make since as to why I am not able to use MySQL functions.
The instructions on php.net said to just copy the php.ini file into the directory that is being shown as your configuration file location if no file can be found.
I have done this, and now receive an error that states “No Input file Specified.” This error comes up when I attempt to run any php file. I have found a few things to try to correct this problem, but none of them seem to work.
Again, if anyone has any more info, I would appreciate it. I have just about given up.
So, thanks again to EVERYONE who helped me with this. If I learn any more, I will be sure to post it as to hopefully save someone the frustration I have gone through in getting this to work.
:)