undefined function mysql_connect

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • zero

    undefined function mysql_connect

    I know this question has come up before (I found lots of sites discussing
    it), but I just can't get it to work.

    I have PHP 5.0.4 and MySQL 5.0.16 (community edition). PHP runs under MS
    IIS 5.1 (XP Pro SP2). Independently, both PHP and MySQL run fine (other
    php pages work fine, and I can access mysql tables through jdbc), but when
    I try to query a database from PHP, I get the infamous "Call to undefined
    function mysql_connect() " error.

    I have uncommented "extension=php_ mysql.dll" in php.ini in G:\php\, which
    in turn is mentioned in the Windows PATH. I have also made sure the
    libmysql.dll and php_mysql.dll files are in the same G:\php\ directory.

    What am I missing here?

    TIA,
    zero
  • MeV

    #2
    Re: undefined function mysql_connect

    Can't speak to a Windows implementation, but on UNIX, unless you've
    built (as in compiled from source) with MySQL support, the mysql
    functions aren't part of the php program.

    What does the output of phpinfo(); show on a web page or php -i in a
    command shell show? If it doesn't list mysql, you'll have to rebuild
    it.

    Comment

    • zero

      #3
      Re: undefined function mysql_connect

      "MeV" <michael.vilain @gmail.com> wrote in news:1132692640 .744248.199900
      @g14g2000cwa.go oglegroups.com:
      [color=blue]
      > Can't speak to a Windows implementation, but on UNIX, unless you've
      > built (as in compiled from source) with MySQL support, the mysql
      > functions aren't part of the php program.
      >
      > What does the output of phpinfo(); show on a web page or php -i in a
      > command shell show? If it doesn't list mysql, you'll have to rebuild
      > it.
      >
      >[/color]

      As I understand it, on windows there is no need to recompile. All
      extension libraries are loaded dynamically on startup, by loading the dlls
      mentioned in php.ini

      At least, that's how I understand it. But obviously I'm missing something,
      since it's not loading the mysql library.

      Comment

      • Jerry Stuckle

        #4
        Re: undefined function mysql_connect

        zero wrote:[color=blue]
        > I know this question has come up before (I found lots of sites discussing
        > it), but I just can't get it to work.
        >
        > I have PHP 5.0.4 and MySQL 5.0.16 (community edition). PHP runs under MS
        > IIS 5.1 (XP Pro SP2). Independently, both PHP and MySQL run fine (other
        > php pages work fine, and I can access mysql tables through jdbc), but when
        > I try to query a database from PHP, I get the infamous "Call to undefined
        > function mysql_connect() " error.
        >
        > I have uncommented "extension=php_ mysql.dll" in php.ini in G:\php\, which
        > in turn is mentioned in the Windows PATH. I have also made sure the
        > libmysql.dll and php_mysql.dll files are in the same G:\php\ directory.
        >
        > What am I missing here?
        >
        > TIA,
        > zero[/color]

        You did stop and start the web server, right?

        What does phpinfo() show?

        Look for the mssql extensions to see if they are loaded.

        Also, which php.ini is it using? Is it the one you changed?

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • zero

          #5
          Re: undefined function mysql_connect

          Jerry Stuckle <jstucklex@attg lobal.net> wrote in
          news:et-dnVxdjKqY6xneRV n-jg@comcast.com:
          [color=blue]
          > zero wrote:[color=green]
          >> I know this question has come up before (I found lots of sites
          >> discussing it), but I just can't get it to work.
          >>
          >> I have PHP 5.0.4 and MySQL 5.0.16 (community edition). PHP runs
          >> under MS IIS 5.1 (XP Pro SP2). Independently, both PHP and MySQL run
          >> fine (other php pages work fine, and I can access mysql tables
          >> through jdbc), but when I try to query a database from PHP, I get the
          >> infamous "Call to undefined function mysql_connect() " error.
          >>
          >> I have uncommented "extension=php_ mysql.dll" in php.ini in G:\php\,
          >> which in turn is mentioned in the Windows PATH. I have also made
          >> sure the libmysql.dll and php_mysql.dll files are in the same G:\php\
          >> directory.
          >>
          >> What am I missing here?
          >>
          >> TIA,
          >> zero[/color]
          >
          > You did stop and start the web server, right?
          >
          > What does phpinfo() show?
          >
          > Look for the mssql extensions to see if they are loaded.
          >
          > Also, which php.ini is it using? Is it the one you changed?
          >[/color]

          It was indeed using the wrong php.ini. I changed the path in the registry,
          and now it works :-)

          Thanks!

          Comment

          • David Haynes

            #6
            Re: undefined function mysql_connect

            zero wrote:[color=blue]
            > I know this question has come up before (I found lots of sites discussing
            > it), but I just can't get it to work.
            >
            > I have PHP 5.0.4 and MySQL 5.0.16 (community edition). PHP runs under MS
            > IIS 5.1 (XP Pro SP2). Independently, both PHP and MySQL run fine (other
            > php pages work fine, and I can access mysql tables through jdbc), but when
            > I try to query a database from PHP, I get the infamous "Call to undefined
            > function mysql_connect() " error.
            >
            > I have uncommented "extension=php_ mysql.dll" in php.ini in G:\php\, which
            > in turn is mentioned in the Windows PATH. I have also made sure the
            > libmysql.dll and php_mysql.dll files are in the same G:\php\ directory.
            >
            > What am I missing here?
            >
            > TIA,
            > zero[/color]
            What do you have extension_dir set to?
            It should point to the ext directory (G:\php\ext)

            -david-

            Comment

            Working...