|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (7 bit)
Join Date: Sep 2004
Posts: 109
|
MySQL-PHP Connection
I can't get PHP to connect to MySQL no matter what I do. I have followed all the instructions on the PHP - MySQL page, but it doesn't work. I'm using Apache 2, PHP 5, MySQL 5.
|
|
|
|
|
|
#2 |
|
Member (9 bit)
Join Date: Sep 2005
Location: UK
Posts: 278
|
How are you trying to connect? Running a php script with mysql_connect? What kind of errors are you getting. Did you place the libmysql.dll in the appropriate folder?
We need a little more info to be able to help you out. |
|
|
|
|
|
#3 | |
|
Staff
Premium Member
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
|
Quote:
__________________
Want to Make $$$$ with your Computer? No Risk! Simply press shift-4 four times in a row |
|
|
|
|
|
|
#4 |
|
Come in Ray...
Join Date: Sep 2004
Posts: 1,668
|
Make sure you have the MySql module enabled in the PHP ini file. For Windows, uncomment the php_mysql.dll line, for Linux, php_mysql.so. You can find this under the [Extensions]. Save your changes and restart Apache.
|
|
|
|
|
|
#5 | |
|
Staff
Premium Member
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
|
Quote:
|
|
|
|
|
|
|
#6 |
|
Member (7 bit)
Join Date: Sep 2004
Posts: 109
|
I'm running WinXP Pro. libmysql.dll is in the C:\php folder, along with php itself. I belive the instructions say that it's ok to leave it there. As far as I know, mysql_connect is the only way to connect to MySQL.
@faulkner, the correct module is mysqli.dll. This is the advanced module that enables use of the new features in MySQL 5. I've tried mysql.dll as well, but it doesn't work. The .so extention is used for Apache modules. As for errors, I've never gotten any from PHP or any of the apps I've written. Rather, I get a blank page. However, phpmyadmin and phpBB have given me errors. phpBB: Your PHP server configuration doesn't support the data base type you chose. phpmyadmin: Cannot connect to MySQL, check your PHP configuration. Or something like that...
Last edited by Kulag; 11-01-2005 at 06:20 AM. |
|
|
|
|
|
#7 |
|
Come in Ray...
Join Date: Sep 2004
Posts: 1,668
|
Kulag,
You need to have both mysql and mysqli enabled if you want to use the "improved" interface. Whatever path you have your extensions set to, make sure it is also in your Window's PATH variable (will have to reboot after doing this). Also make sure your php.ini file is in the C:\Windows directory. If you want to use the mysqli functionality, it has a different set of function calls (i.e. mysqli_connect, mysqli_query, etc.) |
|
|
|
|
|
#8 |
|
Member (7 bit)
Join Date: Sep 2004
Posts: 109
|
@faulkner, how then does this work with scripts that use mysql_connect, etc?
Also, should I use \ or / and should I have a trailing slash or not. It can be fussy about these kind of things. |
|
|
|
|
|
#9 |
|
Chop Chop
|
Are you sure that Apache is running? There should be a feather or something by the clock if it's running. Otherwise you might need to go to Start>Programs>Apache>Run or however you have it setup.
|
|
|
|
|
|
#10 | ||
|
Come in Ray...
Join Date: Sep 2004
Posts: 1,668
|
Quote:
Most functions are just like the standard mysql interface, just with an i on the end. Quote:
|
||
|
|
|
|
|
#11 |
|
Member (7 bit)
Join Date: Sep 2004
Posts: 109
|
What I mean is, will scripts like phpBB which are designed for PHP/MySQL 4, work properly?
|
|
|
|
|
|
#12 | ||
|
Staff
Premium Member
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
|
Quote:
Quote:
|
||
|
|
|
|
|
#13 |
|
Come in Ray...
Join Date: Sep 2004
Posts: 1,668
|
|
|
|
|
|
|
#14 |
|
Member (7 bit)
Join Date: Sep 2004
Posts: 109
|
Erhem, I guess I wasn't clear on that point. I mean the MySQL side of it. My question is that will using the old "mysql_" instead of "mysqli_" for the methods still work, as I'm sure that phpBB and other code is written with the former, and I have code using the former as well.
|
|
|
|
|
|
#15 |
|
Come in Ray...
Join Date: Sep 2004
Posts: 1,668
|
Yes it will still work. Make sure you have both the mysql and mysqli extensions enabled.
|
|
|
|
|
|
#16 |
|
Member (7 bit)
Join Date: Sep 2004
Posts: 109
|
Ok all, thanks for the help, it's working now! I was nearly into pulling hair there, it's been 2-3 weeks I've been working on it.
Side Question: The default MySQL database seems to be InnoDB. How do I change the default to MyISAM? |
|
|
|
|
|
#17 |
|
Come in Ray...
Join Date: Sep 2004
Posts: 1,668
|
When you do a create table query, add the following to the end of the query:
ENGINE=MyISAM |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|