help me <<<<<<mysql php >>>>&a

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
jaylin
Forum Commoner
Posts: 68
Joined: Fri Nov 18, 2005 4:44 am

help me <<<<<<mysql php >>>>&a

Post by jaylin »

Weirdan | Please use

Code: Select all

and

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

and

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]
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

error message tells that your php doesn't have mysql extension installed...
jaylin
Forum Commoner
Posts: 68
Joined: Fri Nov 18, 2005 4:44 am

tell me the solution

Post 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...
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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)
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post 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...
User avatar
phpdevuk
Forum Contributor
Posts: 220
Joined: Mon Jul 04, 2005 5:31 am
Location: UK
Contact:

Post 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?
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
foobar
Forum Regular
Posts: 613
Joined: Wed Sep 28, 2005 10:08 am

Post 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....
jaylin
Forum Commoner
Posts: 68
Joined: Fri Nov 18, 2005 4:44 am

Post 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...
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post 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
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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:

Code: Select all

extension_dir = "./extensions"
Mac
murph2481
Forum Newbie
Posts: 20
Joined: Mon Jun 27, 2005 1:48 pm

install XAMPP

Post 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
Post Reply