Jump to content

I've installed MySQL but....


molisoft

Recommended Posts

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.

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

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)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.