molisoft Posted August 5, 2007 Share Posted August 5, 2007 Hello, I've installed MySQL on Windows XP Professional and can get access to it through Command Prompt but as I try to get access to it through my PHP pages using this function "mysql_connect();" I get this error: "Undefined Function". I've modified php.ini file and set extension_dir to the correct directory and also have uncommented php_mysql.dll extenstion (deleted ";" for the beginning). Well, I still cannot make head nor tail out of it why it is still giving this message to me. Version info: PHP 5.2.3 Apache 2.2.4 MySQL 5.0.0a-alpha Please do me a favor and help me out of this, Thanks so much, MOLiSoft. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted August 5, 2007 Share Posted August 5, 2007 Have you setup the extension_dir directive within the php.ini. the extension_dir directive must point to PHP's extension folder (ext/), eg: extension_dir = "C:/php/ext" Change C:/php to the path in which you have installed PHP to. Save the php.ini and restart Apache. You must restart Apache when ever you change Apaches or PHP's configuration. If you're still getting the undefined function error then make sure PHP is using the php.ini your are editing by running phpinfo within a script. Check that the Loaded Configuration File (or the Configuration File (php.ini) Path) line is set to the full path in which your php.ini is located. Eg if your php.ini is in C:\php then either line should be set to C:\php\php.ini (don't worry if one line shows C:\WINDOWS as the path. Only one or the other needs to be set to php's php.ini path). Quote Link to comment Share on other sites More sharing options...
molisoft Posted August 5, 2007 Author Share Posted August 5, 2007 Hello, Thanks for all the help you gave. I've done all those things before but still I don't get the right thing out of it. I saw php_info() and here is the information it gave me: Configuration(php.ini)Path : C:\WINDOWS Loaded Configuration File : (none) What should I do now? Thanks so much, MOLiSoft. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted August 5, 2007 Share Posted August 5, 2007 OK PHP is not reading your php.ini. Theres the problem. I'm guessing your have your php.ini in C:/php - this is ok however PHP wont be able to read the php.ini in C:/php as it only checks a couple of places for the php.ini which is C:/Windows (or any folder within C:/Windows) the Windows PATH variable or the registry. What I recommend you to do is to add php to the Windows PATH. You can do this by reading this PHP FAQ. Once you have added PHP to the path, PHP should now be able to read your php.ini. Quote Link to comment Share on other sites More sharing options...
molisoft Posted August 6, 2007 Author Share Posted August 6, 2007 Thanks for your help. I did work. Now, I'm looking for commands of MySQL, where can I find them? e.g. the command for changing a user's password or creating a new user....and such things. Thanks for all your help jigaram. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted August 6, 2007 Share Posted August 6, 2007 For getting started with using MySQL with the command line and using PHP with MySQL have a read through the free chapters of this book. Note, the first chapter is for setting up PHP and MySQL. As you already have PHP setup jump to the fourth page and read on from the Post-Installation Setup Tasks heading. Also that tutorial is written for Mac and Unix set ups so ignore the bits about unix and mac. That tutorial goes on for four chapters. Summary of Chapters: Chaptet 1: Setting up AMP (Only read from page four for that chapter as discussed above) Chapter 2: MySQL syntax basics via command line - setting up database, creating tables, inserting, deleting, selecting data etc. Chapter 3: Getting started with PHP, learning the basics, such as variables, functions, arrays, loops etc. Chapter 4: Making the MySQL and PHP application (Jokes database webapp) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.