PHP MySQL Error
PHP MySQL Error
So I'm learning PHP and I got this error message while invoking the mysql_pconnect() function:
[quote=Server]Fatal error: Call to undefined function mysqli_pconnect() in C:\Inetpub\wwwroot\index.php on line 16[/quote]
I searched on the Internet and apparently it means that the version of PHP that I have is not compiled with support for MySQL. Does anybody know how I can fix this or is there a way to work around this problem without needing to compile anything?
[quote=Server]Fatal error: Call to undefined function mysqli_pconnect() in C:\Inetpub\wwwroot\index.php on line 16[/quote]
I searched on the Internet and apparently it means that the version of PHP that I have is not compiled with support for MySQL. Does anybody know how I can fix this or is there a way to work around this problem without needing to compile anything?
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
Re: PHP MySQL Error
Google "Windows PHP MySQLi".XCHG wrote:Does anybody know how I can fix this or is there a way to work around this problem without needing to compile anything?
First thought:
USE="mysqli" emerge php - OK, that's Gentoo Linux, scratch that thought.
Second hit:
Installed PHP5/Apache 2.0/MySQLi -- Yay me!
Third hit:
PHP: mysqli
Fourth hit:
MySQL AB: Download Connector / PHP
Every good solution is obvious once you've found it.
Solar,
Thanks for the prompt reply. I was actually looking at this link but didn't bother with MySQLi. I followed the instructions but now I am getting the same exact error but this time for mysqli of course. I am using:
MySQL 5.0.51a
PHP 5.2.5 (With PHP ISAPI on IIS)
IIS 5.1 on Windows XP SP2
Some of the links also state that PHP should be recompiled even if I want the mysqli extension. Is that correct?
Thanks for the prompt reply. I was actually looking at this link but didn't bother with MySQLi. I followed the instructions but now I am getting the same exact error but this time for mysqli of course. I am using:
MySQL 5.0.51a
PHP 5.2.5 (With PHP ISAPI on IIS)
IIS 5.1 on Windows XP SP2
Some of the links also state that PHP should be recompiled even if I want the mysqli extension. Is that correct?
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
If you want support, I suggest using linux.
Please don't flame - I'm not suggesting this because of hippiness or simple-mindedness. Most php tutorials (including environment setup) assume a LAMP configuration (Linux, Apache, MySQL, PHP), for the simple reason that windows is hardly ever used on the web. IIS is not used that much, and when it is used it is by large businesses who have "enterprise" software in .NET or some similar M$-ised language.
If you run linux, even in a VM, it'll make your setup life a hell of a lot easier. Also it'll help you avoid scratching your chin when that syscall or that bit of inline BASH script in the example PHP scripts work on linux but not on windows!
Please don't flame - I'm not suggesting this because of hippiness or simple-mindedness. Most php tutorials (including environment setup) assume a LAMP configuration (Linux, Apache, MySQL, PHP), for the simple reason that windows is hardly ever used on the web. IIS is not used that much, and when it is used it is by large businesses who have "enterprise" software in .NET or some similar M$-ised language.
If you run linux, even in a VM, it'll make your setup life a hell of a lot easier. Also it'll help you avoid scratching your chin when that syscall or that bit of inline BASH script in the example PHP scripts work on linux but not on windows!
have you looked at the phpinfo()??
are you 100% sure that MySQL & MySQLi are BOTH enabled in the PHP.ini and that the php.ini is even loaded properly?
are you 100% sure that MySQL & MySQLi are BOTH enabled in the PHP.ini and that the php.ini is even loaded properly?
Website: https://joscor.com
Wow. phpinfo() doesn't include anything about MySQL in the report except for the PATH that I have included01000101 wrote:have you looked at the phpinfo()??
are you 100% sure that MySQL & MySQLi are BOTH enabled in the PHP.ini and that the php.ini is even loaded properly?
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
from this (quote from MySQL page):
http://au2.php.net/manual/en/ref.mysql.php
http://au2.php.net/manual/en/ref.mysql.php
PHP 5+
MySQL is no longer enabled by default, so the php_mysql.dll DLL must be enabled inside of php.ini. Also, PHP needs access to the MySQL client library. A file named libmysql.dll is included in the Windows PHP distribution and in order for PHP to talk to MySQL this file needs to be available to the Windows systems PATH. See the FAQ titled "How do I add my PHP directory to the PATH on Windows" for information on how to do this. Although copying libmysql.dll to the Windows system directory also works (because the system directory is by default in the system's PATH), it's not recommended.
As with enabling any PHP extension (such as php_mysql.dll), the PHP directive extension_dir should be set to the directory where the PHP extensions are located. See also the Manual Windows Installation Instructions. An example extension_dir value for PHP 5 is c:\php\ext
Note: If when starting the web server an error similar to the following occurs: "Unable to load dynamic library './php_mysql.dll'", this is because php_mysql.dll and/or libmysql.dll cannot be found by the system.
Microsoft: "let everyone run after us. We'll just INNOV~1"
Ironically, all of the information provided by the official website for PHP is literally useless about IIS/MySQL/PHP. I followed this link which explained what I had to do and everything works now; finally, after 2-3 days.
Thanks guys. I appreciate your help.
Thanks guys. I appreciate your help.
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
Oh and also may I add that I got sick of IIS and installed Apache 2.0. Apparently Apache 2.2.x is not compatible with PHP5; I tried it actually and it didn't work so...
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.
I love IIS... that's what I use for my web-server.
IIS7 is AMAZING. I used to run Server2008 w/ IIS7, and it was probably one of the most user-friendly environments out there.
IIS7 is AMAZING. I used to run Server2008 w/ IIS7, and it was probably one of the most user-friendly environments out there.
Website: https://joscor.com
Really? I tried and it didn't work especially when I noticed that PHP.ini wasn't even being read and that I didn't have any other copies of the file anywhere in the PATH. I even removed its contents and saved it and it didn't change anythingpcmattman wrote:Apache 2.2.x *IS* compatible with PHP5 - I setup a Windows-based server two weeks ago with Apache 2.2.0, PHP5 and MySQL and it's still running smoothly. You just need to make sure all the DLLs are referenced properly in all the configuration files.
On the field with sword and shield amidst the din of dying of men's wails. War is waged and the battle will rage until only the righteous prevails.