Fatal error: Call to undefined function mysql_connect()

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Julian Bowler
    New Member
    • Dec 2008
    • 28

    #16
    that Old Estonian proverb comes to mind; If you think things are really bad don't worry yourself, things will definitely get worse.....

    I have figured out that a simple echo command works fine so php in general seems just fine, next i will try to see firstly what the level of error reporting is at present and then play at changing it to see what happens....

    Comment

    • Julian Bowler
      New Member
      • Dec 2008
      • 28

      #17
      oh yes, it is ok the password i posted is fake, it is not like the real one that will eventually be used on the live server... but thank you for mentioning this it is a good and valid point. on the real program i will us user names and passwords that will not be posted anywhere in any forum.

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #18
        then I'm relieved.

        regards

        Comment

        • Julian Bowler
          New Member
          • Dec 2008
          • 28

          #19
          I have now looked at php.ini and in it there are error handlingg andd loging section and in here there is
          error_reporting = E_ALL
          and
          display_errors = Off
          it is this line that is ensuring that no errors are being sent to the screen, i have changed it to say display _errors = On and then stopped and started Apache and hay now i see the message:

          Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\h tdocs\chephrenr ep........... at line 20
          So we see that the mysql function is still not working.....

          so will go back to look at all the posts in this thread and see if i can try some of the ideas presented as well as googling the problem once more...??????.. .. what i discover will be posted here, any help from anyone in the know with php 5 configuration would be welcome along with the other people that have kindly posted help.. ...

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #20
            you could try the WAMP package....

            Comment

            • Julian Bowler
              New Member
              • Dec 2008
              • 28

              #21
              as per the post by ak1dnar previous, i tried putting this line into php.ini
              extension = php_mysql.dll
              and then saving the file and stopping and then restarting Apache, but what happens is that Apache will not start, and instead we see a message on the screen that says:
              PHP Startup: Unable to load dynamic library 'C|PHP5\ext\php _mysql.dll' - The specified procedure could not be found.

              so please does any one know what this means and does it have any relavance to my problem which is that I can ot run a php script that simply calls the mysql_connect() function??? ?

              What is missing ? Is php unable to run any mysql type function and is the reason possible to discover?
              I come back to this question, what is needed in a php installation to be able to run all mysql functions to communicate with a local MySQL Server??
              And which versions of php work with MySQL? Has Mysql support ben remved form some or all php 5 versions, I am sure I had it all working fine previously with a php 4 version!!?
              is the next thing to try, removing php 5.0.2 and install a php 4 version?

              Comment

              • Julian Bowler
                New Member
                • Dec 2008
                • 28

                #22
                many thanks for Dormilich response, yep i could try a WAMP Package but one thing that concerns me is are there any WAMP Packages that work reliably, and also if the WAMP Package does not work properly can it be uninstalled without messing up my computer.
                Has anybody any experience of WAMP Packages that work well and are straight forward to install, of course i would need a WAMP Package for use on windows XP Home.....
                Finally, would I need to uninstall Apache MySQL and PHP prior to installing a WAMP Package??? What set up of the MySQL part would be required, normally in My SQL you need t remove some default users, and create some new users to get MySQL Server to work I do believe.?

                Comment

                • Dormilich
                  Recognized Expert Expert
                  • Aug 2008
                  • 8694

                  #23
                  Originally posted by Julian Bowler
                  PHP Startup: Unable to load dynamic library 'C|PHP5\ext\php _mysql.dll' - The specified procedure could not be found.
                  the path looks strange. I'd have expected something like 'C:\PHP\...'
                  Originally posted by Julian Bowler
                  And which versions of php work with MySQL? Has Mysql support ben remved form some or all php 5 versions, I am sure I had it all working fine previously with a php 4 version!!?
                  I have 5.2.8. working (through MDB2) and so do thousands of others.

                  Comment

                  • Julian Bowler
                    New Member
                    • Dec 2008
                    • 28

                    #24
                    PHP 5.2.8 working with MDB2, please tell me what is MDB2 is that a relational database like MySQL that can be ran on a web server? I have not herd of MDB2?
                    ta..

                    Comment

                    • Dormilich
                      Recognized Expert Expert
                      • Aug 2008
                      • 8694

                      #25
                      in short MDB2 is a Database Abstraction Package provided through PEAR. see PEAR :: Package :: MDB2 (it makes working with databases easier)

                      note: MDB2 for MySQL uses PHP's mysql functions

                      Comment

                      • Julian Bowler
                        New Member
                        • Dec 2008
                        • 28

                        #26
                        many thanks for your reply, I am tomorrow going to remove php 5.0.2 and then try installing php version 4.4.7, this is the zipped win32 version. I will then attempt to configure this to work with MYSQL that is installed and running on my lap top. I have read on the internet that php 5 does not have MySQL Support built into it and that it has to be configured manually, but I have tried quite a few things so far and i still get the
                        Fatal error: Call to undefined function mysql_connect() in C:\Program Files\Apache Group\Apache2\h tdocs\chephrenr ep.....
                        every time i run the php script calling this function.

                        IF PHP 4.4.7 will not solve the problem I will most likely rebuild the entire Lap Top from scratch starting with using the original cd to put it back to how it was in the factory and then installing Apache, php 4.4.7 which i do hope will work, and then Mysql 4.1.

                        All replies to this thread have been very helpful.... intend to add to this thread tomorrow

                        Comment

                        • ak1dnar
                          Recognized Expert Top Contributor
                          • Jan 2007
                          • 1584

                          #27
                          Sorry guys, I was quite busy with my works last day. :(

                          Ok, back to the questions. My first recommendation is do not revert back to Php 4.x.x as now we have Php 5.x.x which is more powerful and stable.

                          Your problem is some what strange to me. may be as "Dormilich" said, you have used some corrupted version of php installer.

                          Still I suggest you to install MySQL, Php, Apache as separate installations. Doesn't matter if you happy with WAMP also, it a good tool. But I still like to configure them individually.

                          If you need to do it from scarch here we go !

                          Uninstall Php, MySQL, apache from your system.and restart your pc.

                          Install Apache
                          Download apache_2.2.11-win32-x86-openssl-0.9.8i.msi and install it with the default settings.

                          Install MySQL
                          Download and install mySQL from here MySQL 5.1 and install it with default settings

                          Install Php
                          Now get thePhp 5.x.x from php.net, PHP 5.2.8 installer is better.

                          When Installing select the Apache Version 2.2.x as your target web server.

                          Provide the apache configuration dir when asking.
                          ex: C:\Program Files\Apache Software Foundation\Apac he2.2\conf\

                          Then you can select the Extensions > MySQL and enable it. (Do not select all the extensions as it will brake the configuration)

                          Restart the Apache or your PC.

                          Now create a test script ( phpconfigtest.p hp ) with these lines of code and put it to Apache Doc Root. (Hope you know where it is)
                          Code:
                          <?php
                          phpinfo();
                          ?>
                          exceute the page as http://localhost/phpconfigtest.php
                          you will see the Php confuguration info in detail in the page. find the "mySQL" details area. if it is there and if mysql support enabled, you are good to go with Php-MySQL.

                          Happy coding.
                          --ak1dnar

                          Comment

                          • Julian Bowler
                            New Member
                            • Dec 2008
                            • 28

                            #28
                            very helpful response from ak1dnar,many thanks... yep it is possible that some file or files are corrupted it does actually happen!! As to uninstalling Apache, well it appears in the add and remove programs feature of Control Panel, so i guess can be removed using that. also PHP 5.2.2 also appears in add and remove programs, but is is not there as i removed its directory before, that is bizarre and plan bonkers!!

                            Hence i will try to remove Apache using add and remove programs and do the same with MySQL and MySQL Query Browser and MySQL Administrator. then i will remove the current php directory and remove all the files i copied to C:/Windows and to C:/Windows/system and then finally start again with the pieces of software recommended by ak1dnar.

                            just to be clear, you can test whether or not php is working by writing a program like:
                            <?php

                            phpinfo():
                            ?>
                            and running it and you will see a blue page, but you can not test a php connection to a MySQL database unless you write some specific functions to connect and to use a database etc, and to do this you need of course an actual database and a user to actually exist first, and probably a table in that database would be also very useful me thinks......

                            Comment

                            • Dormilich
                              Recognized Expert Expert
                              • Aug 2008
                              • 8694

                              #29
                              Originally posted by Julian Bowler
                              just to be clear, you can test whether or not php is working by writing a program like:
                              Code:
                              <?php
                                  phpinfo();
                              ?>
                              jepp.

                              Originally posted by Julian Bowler
                              and running it and you will see a blue page, but you can not test a php connection to a MySQL database unless you write some specific functions to connect and to use a database etc, and to do this you need of course an actual database and a user to actually exist first, and probably a table in that database would be also very useful me thinks......
                              correct, the phpinfo() tells you whether PHP correctly recognized its MySQL part. testing the mysql functions indeed requires a database, user, ... which are usually unknown to php.ini

                              Comment

                              • Julian Bowler
                                New Member
                                • Dec 2008
                                • 28

                                #30
                                I have now installed all recommended by ak1dnar, and it has all installed fine,but when i run the mysql _connect function in a web page, i get a blank page, absolutely nothing, white screen.....
                                I have checked that in php .ini
                                and there is in it
                                error_reporting = E_ALL
                                and
                                display_errors = On, and i restarted the Apache server,
                                so what is going on why will it apparently not work. what should i try to do next??

                                Comment

                                Working...