![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Jul 2005
Posts: 6
Rep Power: 0
![]() |
another simple question about PHP and mySQL
I am trying to check for access to my database(mysql), therefore I type the following code, and I save it as a php file and I try to run it from my local server in Apache, but an error displays "Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\htdocs\helloworld.php on line 3. My OS is XP
".
<?php
$conn=mysql_connect("localhost","name","password");
echo $conn;
mysql_close($conn);
?> |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
You have to enable php_mysql.dll and php_mysqli.dll in php.ini. You do this by removing the semicolon from these two lines:
;extension=php_mysql.dll ;extension=php_mysqli.dll |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Jul 2005
Posts: 6
Rep Power: 0
![]() |
Ok, but what directory do i have to go to make those changes? I couldn't fine any php_ini. The only directory I found with the files php_mysql.dll and php_mysqli.dll was c/php5/ext and these files didnt have any ; . Where do I have to go to type the while loop an stuff...Please can you explain in more details, I really appretiate your help.
|
|
|
|
|
|
#4 |
|
Professional Programmer
Join Date: Jun 2004
Location: South Africa, Johannesburg
Posts: 301
Rep Power: 5
![]() |
If you don't know where the file is, then just do a search for it. Open it with notepad, then go Edit->Find, then type in: ;extension=php_mysql.dll and press ok. Take away the semi colon, do the same for ';extension=php_mysqli.dll'
__________________
[SIGPIC][/SIGPIC] |
|
|
|
|
|
#5 |
|
Newbie
Join Date: Jul 2005
Posts: 6
Rep Power: 0
![]() |
This is what i get when i open the file with notepad:
MZ? ÿÿ ¸ @ ð º ´ Í!¸LÍ!This rogram annot be run in DOS mode. $ 5¬ßqÍpŒqÍpŒqÍpŒ Ñ|ŒsÍpŒÒzŒtÍpŒÒtŒsÍpŒòÅ-ŒsÍpŒqÍqŒ |
|
|
|
|
|
#6 |
|
Programming Guru
![]() |
You are looking for a file named "php.ini" most likely, not a .dll file.
__________________
|
|
|
|
|
|
#7 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
You see those files called php.ini-dist and php.ini-recommended? Append "C:\PHP" or whatever your PHP location is to your PATH environment variable. You do this by going to Control Panel -> System -> Advanced -> Environment Variables, double-clicking on "Path" and adding ";C:\PHP" to it, then clicking OK a few times. Then make a copy of php.ini-recommended and call it php.ini. Then make the changes.
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|