I just installed Apache 2.2.15/PHP 5.3.2/MySQL 5.1.44 on Windows Vista. Apache is working fine, PHP is functional, and MySQL works on the CLI. However, when I try to access MySQL via PHP, I get an error (Fatal error: Call to undefined function mysql_connect()). extension=php_mysql.dll and extension=php_mbstring.dll are uncommented in the php.ini file, and PHP is in the system path. There is no libmysql.dll in either the top level PHP directory or the ext directory. There's a libmySQL.dll file in the MySQL bin directory (which is also in the system path); I tried renaming it, but that doesn't do anything
Also, in case anyone wants to know, I originally installed PHP using the MSI installer, but it was missing some DLLs, so I installed from the zip file.
I think I've exhausted all my options. Any help on this problem would be very appreciated.
Thanks in advance.
IIRC the msi installer sets some registry values that influence the php configuration, see http://docs.php.net/configuration.changes#configuration.changes.windows. That might change the location of the php.ini that is used. You might want to delete those registry keys. Anyway, you did edit the file that is shown in the output of phpinfo()?
Which build of php do you use? The one you can download from http://windows.php.net/download/? Then you probably have the new mysqlnd transport driver built into the php core dll and don't need libmysql.dll. The mysqlnd driver should show up in the output of phpinfo(). Does it?
It sounds like you do not have the MySQL mod for PHP properly installed or configured. I recommend using AMP on Linux, so sorry for not having any specific instructions for Windows.
Related
My goal is to connect my laravel project to firestore firebase. I will be needing the grpc in order to continue it. However my problem is the .dll cant be found. I already uploaded the .dll file in ext folder.
I also included it in my php.ini file.
still getting the same error
I dont know if its the version og php and grpc is conflicting.
After applying the comments' suggestions:
You need to mention extensions without php_ and .dll prefix and suffix like below:
extension=fileinfo
extension=grpc
Restart Apache server if required. You can also check for php version on the command line using php --version. If it shows the version without any warnings/errors, it means the extensions are loaded correctly.
Also, as the error message in your screenshot suggests, you need to install the right thread safe package of GRPC relevant to your operating system architecture and PHP version from https://pecl.php.net/package/grpc
Since nice_dev pointed out it was a compatibilit issue. I downloaded the non thread x64 and used it. It worked. Been using the x84, maybe the reason why it's not working.
I seem to have a strange problem with PHP.
I've migrated a bunch of software from one server to another. On the server some scripts make a connection to Oracle, so to be able to make a connection the oracle client is installed and a tnsnames file is in place. Connection from sql*plus works.
Some of the scripts use PDO, so for that I've enabled extension=php_pdo_oci.dll in php.ini. These scripts work like a charm.
Some other scripts use functions like oci_connect, and these need a extension like php_oci8.dll. With xammp (that I use as apache/php/mysql bundle) php_oci8_12c.dll is delivered, so I thought that extension would be adequate.
When starting the server, I see these errors in the php errorlog:
Unable to load dynamic library 'C:\xampp\php\ext\php_oci8_12c.dll' - The specified procedure could not be found.
The file is in located in C:\xampp\php\ext\, so that shouldn't be a problem. Other extensions that are in the same dir are picked up without any problems. I've also tried to load php_oci8.dll, wich I picked up from the old server, but got exactly the same problem.
Some answers I found to similar problems I tried without success:
- copying the dll to c:\windows\system
- adding the php ext dir to the system PATH variable
- adding the oracle client to the system PATH variable (was already in there)
The software versions I'm using:
OS: Windows 2012 R2 x64
PHP: 5.6.3
Oracle database: 11.2.0.4.0
Any ideas?
Seems like I figured it out and can answer my own question. It looks like XAMPP is delivering a non-suitable ddl with their distribution.
The right and most recent oci8 dll's are downloadable here in all possible flavors: http://windows.php.net/downloads/pecl/releases/oci8/2.0.8/. Once I got the right one, it worked like a charm.
XAMPP comes with PHP compilled with ThreadSafe, so you have to download the file from this directory:
http://windows.php.net/downloads/pecl/releases/oci8/2.0.8/ …
Before you paste the 3 DLLs to C:\xampp\php\ext*, append ".old*" to each file. Be sure you have enabled the good DLL according to your version of your Oracle database in the file php.ini. Finally, Restart Apache.
I have a problem about loading extension of PHP in MAMP:
I have compiled and installed scws.so (PHP extension for Chinese words segmentation) into folder '/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions' together with other extensions like pgsql.so, etc.
Also, I've updated the php.ini under '/Applications/MAMP/bin/php/php5.3.6' by adding 'extension=scws.so'.
If I issue command '/Applications/MAMP/bin/php/php5.3.6/bin/php -m' in console, I can see 'scws' is in the output list. But it has not been loaded after starting MAMP, also, I can not see 'scws' is listed with function phpinfo().
Could anyone help me about how to force the load of the new PHP extension? Why it is listed by 'php -m', but actually not loaded by MAMP?
Thanks in advance!
The configuration for PHP called from web server is different from command line php. In phpinfo() check the path to the php.ini file that is being used and make sure that it is the same file that you edited to add the extensions.
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.