Page 1 of 1
help me <<<<<<mysql php >>>>&a
Posted: Fri Nov 18, 2005 4:45 am
by jaylin
Weirdan | Please use Code: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
i m very new to php and mysql. today is my first day of php and mysql and i havn't seen these two software.
now, i try to connect mysql. this is the code that provided in php tutorial:
Code: Select all
<?php
$link = mysql_connect('localhost', 'root', '234234');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>
but, i got this error:
Fatal error: Call to undefined function mysql_connect() in c:\Inetpub\wwwroot\test.php on line 5
plz help me. how can i do that?
regards,
Weirdan | Please use Code: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Posted: Fri Nov 18, 2005 5:05 am
by n00b Saibot
error message tells that your php doesn't have mysql extension installed...
tell me the solution
Posted: Fri Nov 18, 2005 5:07 am
by jaylin
so, how can i solve it? i m a notive user and today is the first day that i touch php and mysql
n00b Saibot wrote:error message tells that your php doesn't have mysql extension installed...
Posted: Fri Nov 18, 2005 5:11 am
by timvw
Just search this forum for "mysql extension not installed". Many people before you have had this problem and we've answered it already many times before too. (hint: extension=php_mysql.dll in php.ini)
Posted: Fri Nov 18, 2005 5:20 am
by n00b Saibot
1. make an empty php file with following contents and run it
Code: Select all
<pre>
<?php print_r(get_loaded_extensions()) ?>
</pre>
see if it lists mysql there...
2. search php.ini on C: drive. open it in notepad. scroll down until you see something like this...
PHP.ini wrote:
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;
; extension=modulename.extension
;
; For example, on Windows:
;
; extension=msql.dll
;
; ... or under UNIX:
;
; extension=msql.so
;
; Note that it should be the name of the module only; no directory information
; needs to go here. Specify the location of the extension with the
; extension_dir directive above.
;Windows Extensions
;Note that MySQL and ODBC support is now built in, so no dll is needed for it.
;
;extension=php_bz2.dll
;extension=php_cpdf.dll
;extension=php_crack.dll
extension=php_curl.dll
;extension=php_db.dll
here remove the ; before mysql.dll if there is any such line...
Posted: Fri Nov 18, 2005 5:31 am
by phpdevuk
looks like you are running php on windows from the path given in the error message, how have you installed mysql and php on your system?
Posted: Fri Nov 18, 2005 6:08 am
by twigletmac
phpdevuk wrote:looks like you are running php on windows from the path given in the error message, how have you installed mysql and php on your system?
and which versions?
Mac
Posted: Fri Nov 18, 2005 10:05 am
by foobar
http://www.apachefriends.org is probably the way to go. They've compiled a selection of extensions into PHP and distribute it together with Apache 2 and MySQL 4.1. Neat all-in-one package for beginners.
I actually use it myself, because I'm pretty fed up with getting servers to run on my machine. Loads of problems with Apache, Tomcat 3.x-4.1, IIS4, and some weird Perl server I once had. All those config files to edit... and then it turns out you have to change the batch files as well. And set the correct paths. Not to forget installing any interpreters like PHP or Perl. Gaaah....
Posted: Fri Nov 18, 2005 9:06 pm
by jaylin
I don't see mysql in the list when i use (get_loaded_extensions())
when i remove ; before extension=php_msql.dll and extension=php_mysql.dll
i got the error
PHP Startup: Unable to load dynamic library './php_msql.dll' in php.inc - The specified mode could not be found
When i search php_mysql.dll and libmysql.dll in my computer, i can't find any one. i think this is the main reason. plz tell me how to do that?
plz help me
regards,
n00b Saibot wrote:1. make an empty php file with following contents and run it
Code: Select all
<pre>
<?php print_r(get_loaded_extensions()) ?>
</pre>
see if it lists mysql there...
2. search php.ini on C: drive. open it in notepad. scroll down until you see something like this...
PHP.ini wrote:
;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;
; extension=modulename.extension
;
; For example, on Windows:
;
; extension=msql.dll
;
; ... or under UNIX:
;
; extension=msql.so
;
; Note that it should be the name of the module only; no directory information
; needs to go here. Specify the location of the extension with the
; extension_dir directive above.
;Windows Extensions
;Note that MySQL and ODBC support is now built in, so no dll is needed for it.
;
;extension=php_bz2.dll
;extension=php_cpdf.dll
;extension=php_crack.dll
extension=php_curl.dll
;extension=php_db.dll
here remove the ; before mysql.dll if there is any such line...
Posted: Sat Nov 19, 2005 4:13 am
by timvw
Make sure you get the .zip distribution (not the .exe).
Then you'll have a libmysql.dll in your php dir and php_mysql.dll in php/ext
Posted: Sat Nov 19, 2005 6:54 am
by twigletmac
You also need to make sure that the extension_dir is set correctly in your php.ini as well, for example if your extensions are stored in the extensions directory then you'd need something like this:
Mac
install XAMPP
Posted: Mon Nov 21, 2005 12:19 pm
by murph2481
or you can just install XAMPP and not have to configure anything

And it installs everything for you in one nice easy program and everything is up to date.
http://www.apachefriends.org/en/xampp.html