Fatal error: Call to undefined function

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

    Fatal error: Call to undefined function

    I'm a PHP and MySQL newbie. I have a feeling a lot of you may have seen this
    before. I'm teaching myself PHP/MySQL and trying to setup a guestbook. I'm
    running latest versions of Apache, PHP and MySql on WIN 2000. PHP is
    installed from the zip file. When serving php docs (code snippets below) I
    get the messages:

    "Fatal error: Call to undefined function mysql_connect() "

    "Fatal error: Call to undefined function mysql_pconnect( ) "

    I've been reading and searching and trying all sorts of things to fix this
    and can't find the solution. I've removed the comment from the line
    "extension=php_ mysql.dll" in php.ini. (Below is the MySQL section of
    php.ini. It's pretty standard, I'm using defaults.) I edited my Apache
    config file with the needed lines:

    ### Section 4: PHP 5 Module
    #
    LoadModule php5_module "C:/Program Files/Apache
    Group/Apache2/PHP/php5apache2.dll "
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
    PHPIniDir "C:/Program Files/Apache Group/Apache2/PHP"

    When I run phpinfo, MySQL is not listed. Do I need to enable it in the
    configure command? How do I edit the configure command. Per phpinfo, It now
    reads:

    Configure Command cscript /nologo configure.js "--with-gd=shared"
    "--enable-snapshot-build"

    I read these comments online:

    Ok, your php.ini file is set to 'on' for mysql.allow_per sistent, but is
    mysql really enabled? Does your configure command look something like this?

    './configure'
    '--with-mysql=/usr/local/mysql'......... ............... ............... .....

    If you don't have --with-mysql it means that you cannot use mysql
    functions, so compile PHP again with this option.



    How do I edit that pesky configure command. I searched, but couldn't find an
    answer. So, where am I going wrong? Thanks for reading and big thanks for
    any help.

    gene

    sunishun@verizo n.net



    php.ini snippet (comments removed for easier reading:

    [MySQL]
    mysql.allow_per sistent = On
    mysql.max_persi stent = -1
    mysql.max_links = -1
    mysql.default_p ort =
    mysql.default_s ocket =
    mysql.default_h ost =
    mysql.default_u ser =
    mysql.default_p assword =
    mysql.connect_t imeout = 60
    mysql.trace_mod e = Off


    guest.php code snippet:

    //connect
    // change localhost to your db host name
    mysql_pconnect( "http://aulon.dyndns.or g/", "$username" , "$password" )
    or die( "Unable to connect to SQL server");
    mysql_select_db ( "$db_name") or die( "Unable to select database");
    guestbook.php code snippet:
    // Connect to DB
    $li = mysql_connect($ dbHost, $dbUser, $dbPass) or die("Could not connect");
    mysql_select_db ($dbDatabase, $li) or die ("could not select DB");


  • Jasper Bryant-Greene

    #2
    Re: Fatal error: Call to undefined function

    gc wrote:
    [color=blue]
    > I've been reading and searching and trying all sorts of things to fix this
    > and can't find the solution. I've removed the comment from the line
    > "extension=php_ mysql.dll" in php.ini. (Below is the MySQL section of
    > php.ini. It's pretty standard, I'm using defaults.) I edited my Apache
    > config file with the needed lines:[/color]

    So you've uncommented the extension line in php.ini - have you copied
    libMySQL.dll from the PHP directory (or one of the directories under it
    - I forget what the dir is called now) into your \windows\system 32 or
    equivilant directory? PHP needs this MySQL client library for the
    extension to work.
    [color=blue]
    > How do I edit that pesky configure command. I searched, but couldn't find an
    > answer. So, where am I going wrong? Thanks for reading and big thanks for
    > any help.[/color]

    You can't edit the configure command with a Windows binary distribution
    - the configure command is passed at build-time but you aren't building
    from source.

    --
    Jasper Bryant-Greene
    Cabbage Promotions

    Comment

    • Pjotr Wedersteers

      #3
      Re: Fatal error: Call to undefined function

      gc wrote:[color=blue]
      > I'm a PHP and MySQL newbie. I have a feeling a lot of you may have
      > seen this before. I'm teaching myself PHP/MySQL and trying to setup a
      > guestbook. I'm running latest versions of Apache, PHP and MySql on
      > WIN 2000. PHP is installed from the zip file. When serving php docs
      > (code snippets below) I get the messages:
      >
      > "Fatal error: Call to undefined function mysql_connect() "
      >
      > "Fatal error: Call to undefined function mysql_pconnect( ) "
      >
      > I've been reading and searching and trying all sorts of things to fix
      > this and can't find the solution. I've removed the comment from the
      > line "extension=php_ mysql.dll" in php.ini. (Below is the MySQL
      > section of php.ini. It's pretty standard, I'm using defaults.) I
      > edited my Apache config file with the needed lines:
      >
      > ### Section 4: PHP 5 Module
      > #
      > LoadModule php5_module "C:/Program Files/Apache
      > Group/Apache2/PHP/php5apache2.dll "
      > AddType application/x-httpd-php .php
      > AddType application/x-httpd-php-source .phps
      > PHPIniDir "C:/Program Files/Apache Group/Apache2/PHP"
      >[/color]
      Latest MySQL and PHP5 don't mix by default on Windows. You need another
      Mysqllib. There are some functions that no longer exist in PHP I believe. I
      found it a nightmare to get it to work, but others can probably point out
      how exactly to do this. I gave up after hours of toying, went back to PHP
      4.3.8 so I can't exactly tell you how to go about it.

      Good luck
      Pjotr


      Comment

      • gc

        #4
        Re: Fatal error: Call to undefined function

        Thanks, Pjotr! I went to v4.3.8 and it works with no problems! What a
        headache that was trying to get v5 to work, and me being a newbie, it was
        really not fun at all.

        Thanks also, to everyone that replied.
        gene

        "Pjotr Wedersteers" <x33159@westert erp.com> wrote in message
        news:4131ae42$0 $25965$e4fe514c @news.xs4all.nl ...[color=blue]
        > gc wrote:[color=green]
        > > I'm a PHP and MySQL newbie. I have a feeling a lot of you may have
        > > seen this before. I'm teaching myself PHP/MySQL and trying to setup a
        > > guestbook. I'm running latest versions of Apache, PHP and MySql on
        > > WIN 2000. PHP is installed from the zip file. When serving php docs
        > > (code snippets below) I get the messages:
        > >
        > > "Fatal error: Call to undefined function mysql_connect() "
        > >
        > > "Fatal error: Call to undefined function mysql_pconnect( ) "
        > >
        > > I've been reading and searching and trying all sorts of things to fix
        > > this and can't find the solution. I've removed the comment from the
        > > line "extension=php_ mysql.dll" in php.ini. (Below is the MySQL
        > > section of php.ini. It's pretty standard, I'm using defaults.) I
        > > edited my Apache config file with the needed lines:
        > >
        > > ### Section 4: PHP 5 Module
        > > #
        > > LoadModule php5_module "C:/Program Files/Apache
        > > Group/Apache2/PHP/php5apache2.dll "
        > > AddType application/x-httpd-php .php
        > > AddType application/x-httpd-php-source .phps
        > > PHPIniDir "C:/Program Files/Apache Group/Apache2/PHP"
        > >[/color]
        > Latest MySQL and PHP5 don't mix by default on Windows. You need another
        > Mysqllib. There are some functions that no longer exist in PHP I believe.[/color]
        I[color=blue]
        > found it a nightmare to get it to work, but others can probably point out
        > how exactly to do this. I gave up after hours of toying, went back to PHP
        > 4.3.8 so I can't exactly tell you how to go about it.
        >
        > Good luck
        > Pjotr
        >
        >[/color]


        Comment

        • Sebastian Lauwers

          #5
          Re: Fatal error: Call to undefined function

          gc wrote:
          [color=blue]
          > Thanks, Pjotr! I went to v4.3.8 and it works with no problems! What a
          > headache that was trying to get v5 to work, and me being a newbie, it was
          > really not fun at all.[/color]

          Next time just put your libmysql.dll in your PATH environment.

          AND hell STOP multiposting!!
          You said newbie?
          [color=blue]
          > Thanks also, to everyone that replied.
          > gene[/color]

          Sebastian


          --
          The most likely way for the world to be destroyed,
          most experts agree, is by accident.
          That's where we come in; we're computer professionals.
          We cause accidents.
          --Nathaniel Borenstein

          Comment

          Working...