I am actually ridicously stumped by this. I have downloaded php, MySQL and apache. Apache and php are working together, and it is wonderful. However whatever I do I cannot get php to work with MySQL. I'm using Windows 7 and PHP version 5.2.17 and Apache 2.2
I have gone into php.ini and uncommented out the lines extension=php_mysql.dll, extension=php_mysqli.dll and set the extention in Windows to this extension=msql.dll. I even changed the session path in php.ini to see if it would change anything. Spoiler Alert it didn't. I keep checking phpinfo() but the only information about MySQL and SQL that shows up is sql.safe_mode: off.
I cannot find any answers anywhere, well I have but all it tells me to do is uninstall and reinstall everything. Which I am trying to avoid at all costs. But if that is my only option, can you give suggestions about using WAMP and whether its easier than installing everything individually? Because I did not use WAMP and it took me forever to get this far.
Annabelle,
Are you editing the php.ini file directly or using the wampmanager menus to edit php.ini.
There are actually 2 php.ini files:
the one in c:\wamp\bin\php\php5.2.17 which is used for the PHP CLI environment ( Command Line Interface )
and the one in c:\wamp\bin\apache\apache2.2.x\bin\php.ini ( the one used by apache )
The reason for having 2 is a little complicated but if you ALWAYS use the wampmanager menu links to edit php.ini it will ensure ou always edit the one used by apache.
left click wampmanager icon in the system tray -> PHP -> php.ini
To check that the mysql and mysqli module are loaded go to localhost and from the wamp home page click on the phpinfo link. If the modules are loaded you should see them mentioned in the list of loaded modules in the CONFIGURATION section.
Related
i have tried everything to load curl extension but it is not displayed in the loaded extension list.
In WAMPServer activating and deactivation extension for the WebServer (Apache) is simple
Use the WAMPServer menus, on the icon in the system tray (it may need to be takes out of the extension area to make sure it sits on the taskbar all the time.
left click wampmanager -> PHP -> PHP Extensions
You should see a menu popout like this
Notice, the extension names all listed, if they have a Green Tick then they are activated, if not, they are not. To activate or deactivate the extension click the extensions name. Wait 10 second while WAMPServer restarts Apache automatically for you and there you go, Job Done.
If you want to use PHP CLI
The PHP CLI is controlled differently, there are actually 2 php.ini files. The one in the wamp64\bin\php\php{version} controls the PHP CLI.
You have to edit this one yourself, so edit wamp64\bin\php\php7.4.16\php.ini and make sure that
extension=curl
does not have a # comment in front of it
Its a little odd that it is not already activated as WAMPServer comes, out of the box, with the curl extension pre-activated
as I was using multiple versions of PHP so after deselecting the current version, selecting another version and then again selecting back the current version and then restarting the server made it work.
I've been working on Wamp Server 2.2 . Everything is ok but when I tried to enable a PHP Extension from the icon tray then Apache won't work anymore. Unless I re-install it then it will work. But I need to enable some PHP Extensions like curl and postgre pdo for my project.
I also tried manually editing the php.ini to enable php extensions, still wamp server apache won't work. Any ideas?
Just enabling a php extension from wamp does not work sometimes because if there is no extension for that module in the php's extension folder then wamp will either stop working or might give out some windows pop up error message when you start wamp.
So please check if those modules exists in the extension directory of your php's root folder.
I hope this helps you.
WAMPServer has more than one php.ini file and it is easy for beginners to get confused.
The safest way to edit the Correct php.ini file is to use the wampmanager.exe menu links
left click wampmanager -> PHP -> php.ini
This will edit the \wamp\bin\apache\apache{version}\bin\php.ini file, which is the correct one for effecting php changes for the PHP used on your web site.
The menu links should also work to activate/deactivate PHP extensions as follows :-
wampmanager -> PHP -> PHP Extensions -> click an extension
If the extension has a TICK then it is activated, if not then it is not activated. Each time you click on an extensions name, it will restart Apache to action the activation or deactivation of that extension, so give it a few seconds to complete this restart before checking it worked.
There is also a php.ini file in the \wamp\bin\php\php{version} folder, however this file is only used by the PHP CLI ( Command Line Interface ) so if you chnage this it will have no effect on the php used by Apache.
I just recently setup a fresh install of PHP, Mysql and Apache on my Windows 2003 server. Php is working fine and my Navicat MySQL browser can connect to my tables. However no matter what I do. MySQL doesn't show in phpInfo() even though I have the extensions in my ext folder. I installed PHP via the windows binary installer. Any idea what I'm missing? I'm pretty new to PHP is this is the first time I've tried to setup my own server I'm sure I'm missing something simple. Thanks.
--- EDIT ---
So as suggested by Alan Geleynse I added the extension to my php.ini, now Apache crashes every time I try to enable php_mysql.dll any ideas on this one? I may just restart my php from scratch if this is any more trouble.
You probably need to enable the extension in your php.ini
Search through php.ini for extension and you should see a list, some of which will be commented out. If you remove the comment for MySQL, it should load the extension.
If you do not see it, you should be able to add this line to your php.ini. Make sure that the dll listed is the one you want and is located in your extension directory.
extension=mysql.dll
Seems the issue was not only a missing php_mysql.dll but I was also missing libmysql.dll The installer still borked the install of the extension files though. Oh well it happens thanks to everyone for the help.
Probably apache crashes because of missing dll. There is probably a directory 'ext' in your php installation dir. Check whether there is a 'php_mysql.dll' file in it.
Also, check for directive 'extension_dir' in your php.ini, it must point to the location of extensions directory. For example, I have php installed in 'C:\php' and 'C:\php\ext' folder in it. My php.ini contains line:
extension_dir = "C:/php/ext"
I just fixed this problem on my computer by copying libMysql.dll from the MySql server directory to c:/windows/system32/, just a few minutes ago.
I'm using WAMP on windows, which installs PHP, Apache and MySQL.
I'm now working on something new that requires PostgreSQL. The current install won't do it for me, as I keep getting these errors:
Call to undefined function pg_query()
Always
undefined function
I've installed PostgreSQL 8.3.7-1 for windows, added php_pgsql.dll,php_pdo_pgsql.dll and even libpq.dll, which a note on the PHP page for postgreSQL says Windows users need starting from PHP 5.2.6
Still, I keep getting these errors...
Can someone advise the best course of action? Or should I just uninstall apache and everything else, and do a fresh install of each component seperatly?
xampp doesn't "tell" apache/php which php.ini to use. Therefore php uses its default lookup strategy to find the .ini file. If you haven't changed anything this will be the one in the directory where the apache binary is located, xampp/apache/bin/php.ini. Did you edit this file and removed the semicolon before extension=php_pgsql.dll ?
When in doubt askecho 'php.ini: ', get_cfg_var('cfg_file_path');which file you have to edit.
xampp installs php as a module by default and you have to restart the apache in order to get php to read the php.ini again.
After thatecho extension_loaded('pgsql') ? 'yes':'no';should print yes. If it doesn't stop the apache service, open a command shell, go to your xampp directory and enterapache_start.batThis will start the apache as a console application and you can see startup errors in this console (instead of windows' event manager). If a dll is missing you will get a message box.
Did you enable it in the php ini file?
What does a call to phpinfo() say is installed for extensions?
Depending on what kind of errors you see in the Apache's error.log the answers on this question might be helpful.
I did the same as you did and got rid of the issue.But mine was for xampp. Probably you should re-install your wamp.
I'm trying to use php_dio & php_win32service because I want to query COM10 on my server using php and also get status & restart some of my win services.
Although I'm using the correct dlls (for PHP 5.5 X64 thread safe) I keep getting warning icon on the extensions and there is no error on php log.
I'm clueless what can be done.
please advise.
The Warning icon is presented in that menu for 2 possible reasons
The extension=php_xxx.dll exists in the php.ini file but the dll does not exist in the \ext folder.
The dll exists in \ext folder but the extension=php_xxx.dll line does not exist in the php.ini file.
So which did you forget to do?
Also remember there are 2 php.ini files :-
The one in \wamp\bin\php\php{version}\php.ini is used by PHP CLI only
The one you can edit using the wampmanager->PHP->php.ini menus which is used by when running under Apache.
You say you have used the correct dll's but just to be sure for WAMPServer 2.5 using Apache2.2.9 you need the Thread Safe + VC11 compiled versions