SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Addict Kakarot720's Avatar
    Join Date
    Feb 2001
    Location
    Washington DC
    Posts
    219
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Access denied to php_mysql.dll

    I installed PHP 5.0.4 on Windows 2000 Pro, MySQL 4.0.xx running on the same machine. I initially installed PHP using the
    installer, but then downloaded the zip file and extracted the ext folder to c:\php\ext.
    I have enabled the php_mysql extension in php.ini. I have placed libmysql.dll in c:\windows\system32. Yet when I try to run the jokes.php file from Kevin Yank's book I get these errors:

    Fatal error: Call to undefined function mysql_connect() in c:\Inetpub\wwwroot\jokes.php on line 22

    PHP Warning: PHP Startup: Unable to load dynamic library 'C:\php\ext\php_mysql.dll' - Access is denied. in Unknown on line 0

    Here's the code of jokes.php
    PHP Code:
    <?php
     error_reporting
    (E_ALL);
     echo 
    'debug 1<br />';
     
    ?>
     <body>
     
     <?php
     
    echo 'debug 2<br />';
     if (isset(
    $_GET['addjoke'])): // User wants to add a joke
     
    ?>
     
     <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
     <label>Type your joke here:<br />
     <textarea name="joketext" rows="10" cols="40">
     </textarea></label><br />
     <input type="submit" value="SUBMIT" />
     </form>
     
     <?php else: // Default page display
     
    echo 'debug 3<br />';
     
    //Connect to the database server
     
    $dbcnx mysql_connect('localhost''root''mypsswrd') or die(mysql_error());
     if (!
    $dbcnx) {
     exit(
    '<p>Unable to connect to the ' .
     
    'database server at this time.</p>');
     }
     echo 
    'debug 4<br />';
     
    //Select the jokes database
     
    if (!@mysql_select_db('test')) {
     exit(
    '<p>Unable to locate the joke ' .
     
    'database at this time.</p>');
     }
     echo 
    'debug 5<br />';
     
    //If a joke has been submitted,
     //add it to the database.
     
    if (isset($_POST['joketext'])) {
     
    $joketext $_POST['joketext'];
     
    $sql "INSERT INTO joke SET
     joketext='
    $joketext',
     jokedate=CURDATE()"
    ;
     if (@
    mysql_query($sql)){
     echo 
    '<p>Your joke has been added.</p>';
     } else {
     echo 
    '<p>Error adding submitted joke: ' .
     
    mysql_error() . '</p>';
     }
     }
     echo 
    'debug 6<br />';
     echo 
    '<p>Here are all the jokes in our database:</p>';
     
     
    //Request the text of all the jokes
     
    echo $result = @mysql_query('SELECT joketext FROM joke');
     if (!
    $result) {
     exit(
    '<p>Error performing query: ' .
     
    mysql_error() . '</p>');
     }
     
     
    //Display the text of each joke in a paragraph
     
    while ($row mysql_fetch_array($result)) {
     echo 
    '<p>' $row['joketext'] . '</p>';
     }
     
     
    //When clicked, this link will load this page
     //with the joke submission form displayed.
     
    echo '<p><a href="' $_SERVER['PHP_SELF'] .
     
    '?addjoke=1">Add a joke!</a></p>';
     
     endif;
     
    ?>
     </body>
    Any ideas? I really want to get through this book!!

    Thanx!

  2. #2
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ---------------------------
    Errors = Improved Programming.
    My Site

  3. #3
    SitePoint Addict Kakarot720's Avatar
    Join Date
    Feb 2001
    Location
    Washington DC
    Posts
    219
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for your help, but all of those links say the same thing. which is to copy the libmysql.dll into the system32 folder. I have copied the libmsql.dll into c:/WINNT and c:/WINNT/system32, and it still gives me the access denied error. Have I done the install wrong? Should I completely uninstall PHP and reinstall? This is frustrating b/c I scoured the net for a solution for hours before I made this post.

  4. #4
    SitePoint Addict Kakarot720's Avatar
    Join Date
    Feb 2001
    Location
    Washington DC
    Posts
    219
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    anybody else have suggestions?

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does C:\php\ext\php_mysql.dll exist? That's what seems to be causing the problem.
    - noobus in perpetuum -

  6. #6
    SitePoint Addict Kakarot720's Avatar
    Join Date
    Feb 2001
    Location
    Washington DC
    Posts
    219
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yup it's definitely there. initially it wasn't due to the fact that i used the installer, but once I noticed it wasn't there I downloaded the full release and copied the entire ext folder into c:\php.

    It's hard to believe that I'm having this much trouble with what is, i'm sure, a small problem. It really is frustrating. I wanna learn php bad, but i'm stuck like chuck!!

  7. #7
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, if you want to try again, this is a pretty easy way to get a local amp setup on windows:

    http://www.apachefriends.org/en/xampp.html

    It's hard to say what might be wrong with your install, but the nice thing about xampp is that it goes cleanly into its own directory, and it tends to just work.

    I've used it on both winxp and linux.
    - noobus in perpetuum -

  8. #8
    SitePoint Addict Kakarot720's Avatar
    Join Date
    Feb 2001
    Location
    Washington DC
    Posts
    219
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    nice link. it almost looks too good to be true. i'll give it a try. thanx much eerok!

  9. #9
    PEACE WILL WIN abalfazl's Avatar
    Join Date
    Feb 2005
    Location
    Beyond the seas there is a town
    Posts
    711
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello

    My firend ,

    You are using mysql 4.0.xx

    Did you install mysqli extention?

    http://ir.php.net/manual/en/ref.mysqli.php

    http://php.planetmirror.com/manual/e...extensions.php

    GOOD LUCK MY FIREND!!!!!!!!!!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •