Page 1 of 2
PHP MySQL Error
Posted: Tue Feb 26, 2008 7:08 am
by XCHG
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?
Re: PHP MySQL Error
Posted: Tue Feb 26, 2008 7:21 am
by Solar
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?
Google "Windows PHP MySQLi".
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
Posted: Tue Feb 26, 2008 7:38 am
by XCHG
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?
Posted: Tue Feb 26, 2008 7:41 am
by Solar
No idea... never used PHP / MySQL on Windows. (See my first thought.
)
Posted: Tue Feb 26, 2008 12:29 pm
by DeletedAccount
How about using XAMPP ....
Posted: Tue Feb 26, 2008 1:45 pm
by JamesM
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!
Posted: Tue Feb 26, 2008 1:59 pm
by 01000101
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?
Posted: Tue Feb 26, 2008 5:41 pm
by XCHG
01000101 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?
Wow. phpinfo() doesn't include anything about MySQL in the report except for the PATH that I have included
Posted: Wed Feb 27, 2008 12:27 am
by B.E
from this (quote from MySQL page):
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.
Posted: Wed Feb 27, 2008 9:49 am
by XCHG
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.
Posted: Wed Feb 27, 2008 12:16 pm
by XCHG
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...
Posted: Wed Feb 27, 2008 3:46 pm
by 01000101
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.
Posted: Sat Mar 01, 2008 4:49 am
by pcmattman
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.
Posted: Mon Mar 03, 2008 2:29 am
by XCHG
pcmattman 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.
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 anything
Posted: Mon Mar 03, 2008 5:03 am
by pcmattman
PhpIniDir in Apache's httpd.conf?
Edit: Also, you'd have to setup the handlers for PHP, though I'm pretty sure that you would've already done that.