Where is mysql_connect()?

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

    Where is mysql_connect()?

    I'm running PHP5 on Windows Vista with mysql 5.2. I have a simple php
    file with

    <?
    $dbc = mysql_connect ();
    ?>

    When I run the file, I get this error:
    Fatal error: Call to undefined function mysql_connect() in E:\www
    \mysite\connect test.php on line 2

    PHP seems to be installed correctly. What could I be doing wrong?

  • Simon Stienen

    #2
    Re: Where is mysql_connect() ?

    Am 4 Mar 2007 11:21:30 -0800 schrieb brett:
    PHP seems to be installed correctly. What could I be doing wrong?
    Is it *configured* correctly? Especially: Did you load the mysql extension?

    Comment

    • brett

      #3
      Re: Where is mysql_connect() ?

      On Mar 4, 11:23 am, Simon Stienen <n...@news.slas hlife.orgwrote:
      Am 4 Mar 2007 11:21:30 -0800 schrieb brett:
      >
      PHP seems to be installed correctly. What could I be doing wrong?
      >
      Is it *configured* correctly? Especially: Did you load the mysql extension?
      I only installed mysql and created a database. There are a few
      problems. I'd like to move the database but don't know how and am not
      sure how to tell mysql where it is to allow connections.

      There isn't a mysql odbc in the odbc administrator tools.

      I just downloaded the extension listed here: http://dev.mysql.com/downloads/connector/php/.
      They talk about modifying a php.ini file. However, I don't have that
      file. The closest files I have are:

      - php.ini-dist
      - php.ini-recommended

      Does all of that sound correct? Thanks.

      Comment

      • Simon Stienen

        #4
        Re: Where is mysql_connect() ?

        Am 4 Mar 2007 12:45:12 -0800 schrieb brett:
        The closest files I have are:
        >
        - php.ini-dist
        - php.ini-recommended
        >
        Does all of that sound correct? Thanks.
        Those two are actually php.ini templates.

        HTH,

        simon Stienen

        (I just noticed that I've got to configure my quote lines to be English
        again... I hate reinstalling software.)

        Comment

        • PDannyD

          #5
          Re: Where is mysql_connect() ?

          brett wrote:
          I'm running PHP5 on Windows Vista with mysql 5.2. I have a simple php
          file with
          >
          <?
          $dbc = mysql_connect ();
          ?>
          >
          When I run the file, I get this error:
          Fatal error: Call to undefined function mysql_connect() in E:\www
          \mysite\connect test.php on line 2
          >
          PHP seems to be installed correctly. What could I be doing wrong?
          What does phpinfo() bring up? If you can't see MySQL in there then it needs
          to be installed/configured.

          Comment

          • =?ISO-8859-15?Q?Iv=E1n_S=E1nchez_Ortega?=

            #6
            Re: Where is mysql_connect() ?

            brett wrote:
            I'm running PHP5 on Windows Vista with mysql 5.2. I have a simple php
            file with
            RTFM. Mysql support was dropped by default in the upgrade from PHP4 to PHP5.
            Get the php_mysql.dll library, put it in the appropiate place, and check
            that it is loaded (see php.ini).

            --
            ----------------------------------
            Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

            Todo conocimiento comienza por los sentimientos.- Leonardo da Vinci.

            Comment

            • brett

              #7
              Re: Where is mysql_connect() ?

              On Mar 4, 12:43 pm, PDannyD <dan1...@scenic place.freeserve .co.uk>
              wrote:
              brett wrote:
              I'm running PHP5 on Windows Vista with mysql 5.2. I have a simple php
              file with
              >
              <?
              $dbc = mysql_connect ();
              ?>
              >
              When I run the file, I get this error:
              Fatal error: Call to undefined function mysql_connect() in E:\www
              \mysite\connect test.php on line 2
              >
              PHP seems to be installed correctly. What could I be doing wrong?
              >
              What does phpinfo() bring up? If you can't see MySQL in there then it needs
              to be installed/configured.
              I've installed the extensions and configured php.ini. I renamed php-
              recommended to php.ini since one didn't exist. I set the
              externsion_dir to my "ext" path but phpinfo() keeps showing it as c:
              \PHP5, which doesn't exist. Any idea why that is happening?

              Thanks.

              Comment

              • Hendri Kurniawan

                #8
                Re: Where is mysql_connect() ?

                brett wrote:
                I'm running PHP5 on Windows Vista with mysql 5.2. I have a simple php
                file with
                >
                <?
                $dbc = mysql_connect ();
                ?>
                >
                When I run the file, I get this error:
                Fatal error: Call to undefined function mysql_connect() in E:\www
                \mysite\connect test.php on line 2
                >
                PHP seems to be installed correctly. What could I be doing wrong?
                >
                Brett,

                Your MySQL extension is not configured correctly.
                Form what I gather from the replies on this thread, you managed to
                download the extension and modify php.ini file (to load and mysql
                extension). So I assume those steps are complete.

                If you are running IIS, PHP is configured to search for php.ini in (as I
                recall, CMIIW) your windows directory and your php installation dir.
                Again, from what I gather your current installation uses php.ini from
                c:\PHP5 dir. You should modify that file instead. Restart your IIS

                If you are running apache however, you need to add
                PHPIniDir "C:\php5"
                to your apache config file (where c:\php5 is where you put your php.ini)
                Restart Apache.

                If you don't see any result (ie. mysql still not loaded), then your php
                is still not configured correctly.

                Hope that helps,

                Hendri Kurniawan

                Comment

                • Simon Stienen

                  #9
                  Re: Where is mysql_connect() ?

                  On 2007-03-04 23-50-08, Hendri Kurniawan wrote:
                  If you are running apache however, you need to add
                  PHPIniDir "C:\php5"
                  to your apache config file (where c:\php5 is where you put your php.ini)
                  Restart Apache.
                  You don't _need_ to add this line. It's still possuble to put the ini file
                  into one of the classic locations:
                  a) c:\windows
                  b) apaches base directory (the one /bin, /conf, /log, ... are located in)
                  c) the directory the sapi dll is located in (iirc, not absolutely positive
                  on this one)

                  Regards,

                  Simon Stienen

                  Comment

                  • brett

                    #10
                    Re: Where is mysql_connect() ?

                    On Mar 4, 3:28 pm, Simon Stienen <n...@news.slas hlife.orgwrote:
                    On 2007-03-04 23-50-08, Hendri Kurniawan wrote:
                    >
                    If you are running apache however, you need to add
                    PHPIniDir "C:\php5"
                    to your apache config file (where c:\php5 is where you put your php.ini)
                    Restart Apache.
                    >
                    You don't _need_ to add this line. It's still possuble to put the ini file
                    into one of the classic locations:
                    a) c:\windows
                    b) apaches base directory (the one /bin, /conf, /log, ... are located in)
                    c) the directory the sapi dll is located in (iirc, not absolutely positive
                    on this one)
                    >
                    Regards,
                    >
                    Simon Stienen
                    As mentioned earlier, I don't have a "c:\php5" folder on this machine
                    and I'm running Windows Vista. Placing the php.ini folder in the
                    windows folder doesn't help. After restarting IIS, I get a blank
                    white page. So I put the file back in my php folder, restart IIS and
                    it works again but PHP is still pointing to the wrong extension_dir
                    and the mysqlconnect() isn't recognized.

                    Thanks.

                    Comment

                    • Jerry Stuckle

                      #11
                      Re: Where is mysql_connect() ?

                      brett wrote:
                      On Mar 4, 12:43 pm, PDannyD <dan1...@scenic place.freeserve .co.uk>
                      wrote:
                      >brett wrote:
                      >>I'm running PHP5 on Windows Vista with mysql 5.2. I have a simple php
                      >>file with
                      >><?
                      >>$dbc = mysql_connect ();
                      >>?>
                      >>When I run the file, I get this error:
                      >>Fatal error: Call to undefined function mysql_connect() in E:\www
                      >>\mysite\conne cttest.php on line 2
                      >>PHP seems to be installed correctly. What could I be doing wrong?
                      >What does phpinfo() bring up? If you can't see MySQL in there then it needs
                      >to be installed/configured.
                      >
                      I've installed the extensions and configured php.ini. I renamed php-
                      recommended to php.ini since one didn't exist. I set the
                      externsion_dir to my "ext" path but phpinfo() keeps showing it as c:
                      \PHP5, which doesn't exist. Any idea why that is happening?
                      >
                      Thanks.
                      >
                      Are you using the correct php.ini? phpinfo() will tell you.

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

                      Comment

                      • BKDotCom

                        #12
                        Re: Where is mysql_connect() ?

                        On Mar 4, 5:56 pm, "brett" <acco...@cygen. comwrote:
                        As mentioned earlier, I don't have a "c:\php5" folder on this machine
                        and I'm running Windows Vista. Placing the php.ini folder in the
                        windows folder doesn't help. After restarting IIS, I get a blank
                        white page. So I put the file back in my php folder, restart IIS and
                        it works again but PHP is still pointing to the wrong extension_dir
                        and the mysqlconnect() isn't recognized.
                        >
                        Thanks.
                        In your php.ini, do you have:

                        extension_dir = "./ext"

                        ?

                        Comment

                        • brett

                          #13
                          Re: Where is mysql_connect() ?

                          In your php.ini, do you have:
                          >
                          extension_dir = "./ext"
                          >
                          ?
                          No, but I can change it. I do see the phpinfo() is saying the
                          configuration file is in c:\windows. Not sure why. So I moved it
                          from my php folder into the windows folder. Now I get a blank white
                          page when I browse to the php file. View source shows my php code. At
                          the least, phpinfo() should still execute. Any idea what is wrong?

                          Thanks,
                          brett

                          Comment

                          • Hendri Kurniawan

                            #14
                            Re: Where is mysql_connect() ?

                            brett wrote:
                            >In your php.ini, do you have:
                            >>
                            >extension_di r = "./ext"
                            >>
                            >?
                            >
                            No, but I can change it. I do see the phpinfo() is saying the
                            configuration file is in c:\windows. Not sure why. So I moved it
                            from my php folder into the windows folder. Now I get a blank white
                            page when I browse to the php file. View source shows my php code. At
                            the least, phpinfo() should still execute. Any idea what is wrong?
                            >
                            Thanks,
                            brett
                            >

                            Well, that means the correct php.ini location should be in c:\windows
                            folder.

                            There is something wrong with the php.ini file that caused php to crash,
                            which in turn did not process the script properly.

                            What I suspect (best guessing here), that one of the php extension is
                            in conflict with php. I suggest that you comment all the extension
                            loading line php have in the php.ini.

                            Check if PHP (phpinfo()) works again. If it does, then you have found
                            your bug. To further isolate which extension actually crash PHP,
                            un-comment the extension one-by-one and try phpinfo() each time.

                            If it still does not work, I can't help you any further, coz I have
                            **very** limited knowledge on ISS + PHP.

                            Hendri

                            Comment

                            • brett

                              #15
                              Re: Where is mysql_connect() ?

                              On Mar 5, 3:48 pm, Hendri Kurniawan <ask...@email.c omwrote:
                              brett wrote:
                              In your php.ini, do you have:
                              >
                              extension_dir = "./ext"
                              >
                              ?
                              >
                              No, but I can change it. I do see the phpinfo() is saying the
                              configuration file is in c:\windows. Not sure why. So I moved it
                              from my php folder into the windows folder. Now I get a blank white
                              page when I browse to the php file. View source shows my php code. At
                              the least, phpinfo() should still execute. Any idea what is wrong?
                              >
                              Thanks,
                              brett
                              >
                              Well, that means the correct php.ini location should be in c:\windows
                              folder.
                              >
                              There is something wrong with the php.ini file that caused php to crash,
                              which in turn did not process the script properly.
                              >
                              What I suspect (best guessing here), that one of the php extension is
                              in conflict with php. I suggest that you comment all the extension
                              loading line php have in the php.ini.
                              >
                              Check if PHP (phpinfo()) works again. If it does, then you have found
                              your bug. To further isolate which extension actually crash PHP,
                              un-comment the extension one-by-one and try phpinfo() each time.
                              >
                              If it still does not work, I can't help you any further, coz I have
                              **very** limited knowledge on ISS + PHP.
                              >
                              Hendri- Hide quoted text -
                              >
                              - Show quoted text -
                              I've commented out all of the extensions, restarted IIS and still a
                              blank white page. Thanks.

                              Comment

                              Working...