faqts : Computers : Programming : Languages : PHP : Installation and Setup : Databases

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

2 of 2 people (100%) answered Yes
Recently 2 of 2 people (100%) answered Yes

Entry

PHP: v5: Database: MySql: Microsoft: Windows: How to install PHP v5 with MySql v5 support?

Apr 26th, 2007 13:27
Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 28 March 2021 - 01:49 am ----------------------
PHP: v5: Database: MySql: Microsoft: Windows: How to install PHP v5 
with MySql v5 support?
---
Steps: Overview:
 1. -Download PHP zip file (e.g. v5.2.1 or higher)
     at
     http://www.php.net
 2. -Unpack it in e.g. the directory
      c:\PHP
     (so no installer .exe program should be run)
     Note:
      installing PHP in a directory containing spaces
      might give errors, e.g. in IIS,
      so do not use e.g. 'c:\program files\php',
      or use the short filename then
 3. -Add the path to your <PHP directory> to your
     Microsoft Windows environment path
     (in control panel -> system -> advanced -> environment variables
      -> system variables -> path)
 4. -Copy the file
      c:\php\php.ini-recommended
     in your PHP directory
     as the new
      php.ini
     ---
     Note:
     It is the best general solution to copy this php.ini
     to your local PHP directory (that is where your php.exe or
     php-cgi.exe file is located, e.g. 'c:\PHP' by default).
     This because if you have say PHP 3, PHP 4 and PHP 5 installed on
     your computer, they then all have their own php.ini in that case.
     And should you keep your php.ini centrally in your c:\windows
     directory, then all these different versions will usually try to
     use that one php.ini (which is usually only optimized and usable
     for only one version of PHP (e.g. PHP5) at once).
     Thus possibly delete the central php.ini in your c:\windows
     directory and keep a local php.ini in each of your PHP version
     directories.
 5. -Open this php.ini file in your favorite text editor, and remove
     the ';' in front of the line
      extension=php_mysql.dll
 6. -Set the extension_dir to
      extension_dir = "c:\php\ext"
     (you can also try ".\ext\")
 7. -Then save this php.ini file again
 8. -Set system variable
      PHPRC
     to
      <your PHP directory containing your php.ini file>
     (otherwise you might get error
      'call to undefined function mysql_connect()',
      in that case check also that you have used
       <?php
      instead
      of
       <?
      in your PHP source code
      )
    -Add it to
     Microsoft Windows environment
     (in control panel -> system -> advanced -> environment variables
      -> system variables -> new -> PHPRC -> c:\php\ )
 9. -Restart your computer
10. -If you now use mysql functions in php v5, they should work
     as intended
===
Note:
To troubleshoot:
1. -Check if php.ini is found: you should see this in phpinfo() output.
    Otherwise just copy your php.ini to the c:\windows directory
    (if you see only 'c:\windows', php.ini is not found. You should
     see at least e.g. 'c:\php\php.ini' otherwise 'c:\windows\php.ini')
2. -Check if your extension is set, you should see this in phpinfo()
    (e.g. c:\php\ext)
===
Tested successfully on Microsoft Windows XP Professional,
service pack 2, running
1. mysql-essential-5.0.37-win32.msi
2. php-5.2.1-Win32.zip
3. Microsoft Internet Information Server (IIS) v5.1
===
Internet: see also:
---
[Internet: source: http://www.google.com search for 'mysql php 5 
install windows': http://nl2.php.net/mysql]
----------------------------------------------------------------------