Error using mysql with php4

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

    Error using mysql with php4

    hello,

    I'm using the php4-mysql module with php4 under debian linux (sarge). I
    have a script, schedule.php, which runs fine when I invoke it from the
    command line, but fails with the error:

    Fatal error: Call to undefined function: mysql_connect() in
    /local/rivulet/interface/db.php on line 4

    when I try to invoke it as a web page (using apache2). As far as I know,
    php itself is set up correctly.

    The error is in the following insert:

    <?php


    $db = mysql_connect(S QL_HOST, SQL_USER, SQL_PASSWD);

    mysql_select_db (SQL_DATABASE,$ db);

    ?>

    The capitalised constants are defined in config.php:

    <?php
    define('SQL_HOS T', 'localhost');
    define('SQL_USE R', 'rivulet');
    define('SQL_PAS SWD', '******');
    define('SQL_DAT ABASE', 'rivulet');

    define('TMP_DIR ','/tmp');
    define('NO_PROG RAMME_MESSAGE', 'To be confirmed');
    define('DISPLAY _EMPTY_SLOTS',T RUE);
    define('INSTALL _ROOT','/local/radio/');
    ?>

    which is include (require_once) in the script I'm invoking.

    does anyone have any clue what might be wrong?

    thanks, andy.

    --


    remove 'n-u-l-l' to email me. html mail or attachments will go in the spam
    bin unless notified with [html] or [attachment] in the subject line.

  • Jim Ottaway

    #2
    Re: Error using mysql with php4

    >>>>> Andy Baxter <news4@earthson g.null.free-online.co.uk> writes:
    [color=blue]
    > hello,
    > I'm using the php4-mysql module with php4 under debian linux (sarge). I
    > have a script, schedule.php, which runs fine when I invoke it from the
    > command line, but fails with the error:[/color]
    [color=blue]
    > Fatal error: Call to undefined function: mysql_connect() in
    > /local/rivulet/interface/db.php on line 4[/color]
    [color=blue]
    > when I try to invoke it as a web page (using apache2). As far as I know,
    > php itself is set up correctly.[/color]

    I had this problem using sarge too. I got it working by adding
    extension=mysql .so to the php.ini in /etc/php4/apache.

    Regards,

    --
    Jim Ottaway

    Comment

    • Jim Ottaway

      #3
      Re: Error using mysql with php4

      >>>>> Jim Ottaway <j.ottaway@lse. ac.uk> writes:[color=blue][color=green][color=darkred]
      >>>>> Andy Baxter <news4@earthson g.null.free-online.co.uk> writes:[/color]
      >> hello,
      >> I'm using the php4-mysql module with php4 under debian linux (sarge). I
      >> have a script, schedule.php, which runs fine when I invoke it from the
      >> command line, but fails with the error:[/color][/color]
      [color=blue][color=green]
      >> Fatal error: Call to undefined function: mysql_connect() in
      >> /local/rivulet/interface/db.php on line 4[/color][/color]
      [color=blue][color=green]
      >> when I try to invoke it as a web page (using apache2). As far as I know,
      >> php itself is set up correctly.[/color][/color]
      [color=blue]
      > I had this problem using sarge too. I got it working by adding
      > extension=mysql .so to the php.ini in /etc/php4/apache.[/color]

      Sorry, ignore that: I thought that's what I did, but I subsequently
      stopped using apache in favour of lighttpd.

      The extension=mysql .so gets added right at the very end of the
      configuration by the mysql installation, so I didn't spot it;
      following my advice actually leads to a duplicate extension error.

      Has apache been reloaded/restarted since you installed mysql? That
      would pick up the configuration change.

      Regards,

      --
      Jim Ottaway

      Comment

      • Andy Baxter

        #4
        Re: Error using mysql with php4

        Jim Ottaway said:
        [color=blue][color=green][color=darkred]
        >>>>>> Jim Ottaway <j.ottaway@lse. ac.uk> writes:
        >>>>>> Andy Baxter <news4@earthson g.null.free-online.co.uk> writes:
        >>> hello,
        >>> I'm using the php4-mysql module with php4 under debian linux (sarge). I
        >>> have a script, schedule.php, which runs fine when I invoke it from the
        >>> command line, but fails with the error:[/color][/color]
        >[color=green][color=darkred]
        >>> Fatal error: Call to undefined function: mysql_connect() in
        >>> /local/rivulet/interface/db.php on line 4[/color][/color]
        >[color=green][color=darkred]
        >>> when I try to invoke it as a web page (using apache2). As far as I know,
        >>> php itself is set up correctly.[/color][/color]
        >[color=green]
        >> I had this problem using sarge too. I got it working by adding
        >> extension=mysql .so to the php.ini in /etc/php4/apache.[/color]
        >
        > Sorry, ignore that: I thought that's what I did, but I subsequently
        > stopped using apache in favour of lighttpd.
        >
        > The extension=mysql .so gets added right at the very end of the
        > configuration by the mysql installation, so I didn't spot it;
        > following my advice actually leads to a duplicate extension error.
        >
        > Has apache been reloaded/restarted since you installed mysql? That
        > would pick up the configuration change.[/color]

        You were right the first time - the line you said was in php.ini, but
        commented out. Removing the comment fixed it.

        Thanks, andy.

        --


        remove 'n-u-l-l' to email me. html mail or attachments will go in the spam
        bin unless notified with [html] or [attachment] in the subject line.

        Comment

        • Jim Ottaway

          #5
          Re: Error using mysql with php4

          >>>>> Andy Baxter <news4@earthson g.null.free-online.co.uk> writes:[color=blue]
          > Jim Ottaway said:[color=green]
          >>
          >> Sorry, ignore that: I thought that's what I did, but I subsequently
          >> stopped using apache in favour of lighttpd.
          >>
          >> The extension=mysql .so gets added right at the very end of the
          >> configuration by the mysql installation, so I didn't spot it;
          >> following my advice actually leads to a duplicate extension error.
          >>
          >> Has apache been reloaded/restarted since you installed mysql? That
          >> would pick up the configuration change.[/color][/color]
          [color=blue]
          > You were right the first time - the line you said was in php.ini, but
          > commented out. Removing the comment fixed it.[/color]

          Ahh. Hmm. Good!

          Regards,

          --
          Jim Ottaway

          Comment

          Working...