Home  >  Article  >  Backend Development  >  IIS 7.5 configure php 5.4.22 link sql 2008 (use PDO to link to the database)_PHP tutorial

IIS 7.5 configure php 5.4.22 link sql 2008 (use PDO to link to the database)_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:17:04934browse

I have recently come into contact with PHP. Regarding the PHP configuration under the wndows system, although there are many articles on the Internet, sometimes it is troublesome to find some configurations, so I would like to share them with you.

1.php 5.4.22

Download address http://windows.php.net/download/#php-5.4-nts-VC9-x86

Select version: PHP 5.4 (5.4.22), VC9 x86 Thread Safe (php-5.4.22-Win32-VC9-x86.zip)

After unzipping, change the name of php.ini-development file to php.ini

2. Configure php.ini

short_open_tag = On supports b26da186e11666e6dd99f28d6205715c writing

date.timezone = PRC or add date_default_timezone_set("PRC") at the top of PRC program; set the default time zone to Beijing time

extension_dir = "ext" specifies the php extension module as the ext directory

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE does not prompt for some information data (such as: warning

3. Support sql 2008 database link, go to Microsoft to download sqlsrv 3

Download link http://www.microsoft.com/en-us/download/details.aspx?id=20098

The download is exe, you can unzip it directly and put php_pdo_sqlsrv_54_ts.dll and php_sqlsrv_54_ts.dll into the ext directory

extension=php_pdo_sqlsrv_54_ts.dll
extension=php_sqlsrv_54_ts.dll

Note: ts is thread-safe, nts is non-thread-safe, and must be consistent with the downloaded php version

There are other extension libraries such as: gd library, mbstring, sqlite, mysql, etc. These are all together, so I won’t go into details.

4. Database link string

<span $db</span>= <span new</span> PDO("sqlsrv:server=127.0.0.1;database=dbname","user1","123456");

5. Configure PHP to IIS7.5

I am using win7 system. First install the FastCGI function of IIS. Go to Control Panel > Open Programs and Features > Click to turn Windows features on or off

Expand in order: Internet Information Services > World Wide Web Services > Application Development Function, check CGI

After installation, open IIS, you can open the processing mapping program in the default site

After entering, right-click and add module mapping

How to configure the website directory is the simplest. I won’t explain it in detail. You can create a new a.php in the website directory and enter the code

<span phpinfo</span>();

Run result:

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/626642.htmlTechArticleI have recently come into contact with PHP. Regarding the PHP configuration under the wndows system, although there are many articles on the Internet, there are Sometimes some configurations are troublesome to find, so I share them with you. 1. php 5.4....
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn