2018-07-22 Install PHP & Think-PHP5 on Windows-7

Step 1 Download php-7 from official web-site

I selected to download php-71 VC14 x64 Thread Safe (2018-Jul-19 11:54:52)from the official site

Step 2 Make a copy of the configuration file

  • Make a copy of the configuration file copy php.ini-development php.ini
  • Open the file and change the value for extension_dir
extension_dir = "E:\Downloads\tools\php71\ext"

Step 3 Configure PHP for Apache

  • Open Apache's configuration file conf\httpd.conf, from E:\Downloads\tools\Apache24\conf
  • Add LoadModule php7_module E:/Downloads/tools/php71/php7apache2_4.dll to the LoadModule sections
  • Add PHPIniDir "E:/Downloads/tools/php71/" to the end of the configuration file.
  • Add below AddType application/x-gzip .gz .tgz
  • Restart Apache by httpd.exe -k restart

Step 4 Test the installation

  • Create a file test.php under E:\Downloads\tools\Apache24\htdocs
E:\Downloads\tools\Apache24\htdocs>type test.php
<?php  phpinfo(); ?>
  • Access from the browser & check http://localhost:7070/test.php

Step 5 Download and install think-php

  • Create a folder for it
  • Change directory to the folder
E:\Downloads\tools>mkdir tp5
E:\Downloads\tools>cd tp5
E:\Downloads\tools\tp5>
  • Clone the source code using git
E:\Downloads\tools\tp5>cd ..

E:\Downloads\tools>git clone https://github.com/top-think/think tp5
Cloning into 'tp5'...
remote: Counting objects: 13548, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 13548 (delta 0), reused 0 (delta 0), pack-reused 13545
Receiving objects: 100% (13548/13548), 23.21 MiB | 256.00 KiB/s, done.
Resolving deltas: 100% (8143/8143), done.

E:\Downloads\tools>cd tp5

E:\Downloads\tools\tp5>git clone https://github.com/top-think/framework thinkphp
Cloning into 'thinkphp'...
remote: Counting objects: 44318, done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 44318 (delta 10), reused 20 (delta 5), pack-reused 44281
Receiving objects: 100% (44318/44318), 12.97 MiB | 495.00 KiB/s, done.
Resolving deltas: 100% (27409/27409), done.

E:\Downloads\tools\tp5>

Step 6 Configure for Apache

  • Copy the folder tp5 into E:\Downloads\tools\Apache24\htdocs
E:\Downloads\tools\Apache24\htdocs>tree .
卷 Tools 的文件夹 PATH 列表
卷序列号为 E885-5830
E:\DOWNLOADS\TOOLS\APACHE24\HTDOCS
└─tp5
    ├─application
    │  └─index
    │      └─controller
    ├─config
    ├─extend
    ├─public
    │  └─static
    ├─route
    ├─runtime
    │  └─cache
    ├─thinkphp
    │  ├─lang
    │  ├─library
    │  │  ├─think
    │  │  │  ├─cache
    │  │  │  │  └─driver
    │  │  │  ├─config
    │  │  │  │  └─driver
    │  │  │  ├─console
    │  │  │  │  ├─bin
    │  │  │  │  ├─command
    │  │  │  │  │  ├─make
    │  │  │  │  │  │  └─stubs
    │  │  │  │  │  └─optimize
    │  │  │  │  ├─input
    │  │  │  │  └─output
    │  │  │  │      ├─descriptor
    │  │  │  │      ├─driver
    │  │  │  │      ├─formatter
    │  │  │  │      └─question
    │  │  │  ├─db
    │  │  │  │  ├─builder
    │  │  │  │  ├─connector
    │  │  │  │  └─exception
    │  │  │  ├─debug
    │  │  │  ├─exception
    │  │  │  ├─facade
    │  │  │  ├─log
    │  │  │  │  └─driver
    │  │  │  ├─model
    │  │  │  │  ├─concern
    │  │  │  │  └─relation
    │  │  │  ├─paginator
    │  │  │  │  └─driver
    │  │  │  ├─process
    │  │  │  │  ├─exception
    │  │  │  │  └─pipes
    │  │  │  ├─response
    │  │  │  ├─route
    │  │  │  │  └─dispatch
    │  │  │  ├─session
    │  │  │  │  └─driver
    │  │  │  ├─template
    │  │  │  │  ├─driver
    │  │  │  │  └─taglib
    │  │  │  ├─validate
    │  │  │  └─view
    │  │  │      └─driver
    │  │  └─traits
    │  │      └─controller
    │  └─tpl
    └─vendor
  • Modify conf/httpd.conf, remove the indexes for the directory access
<Directory "${SRVROOT}/htdocs">
    Options FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>
  • Configure Apache to recognize index.php
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>
  • Restart Apache using httpd.exe -k restart
  • Visit http://localhost:7070/tp5/public/ and now we see welcome page from think-php

Reference

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Getting Started Use the Current Stable Version (7.1) Buil...
    Leonzai阅读 2,078评论 0 3
  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,888评论 0 10
  • 一直以来,美国为了弥补国内STEAM人才的空缺,推行过许多方案。近年来,美国甚至降低“绿卡”门槛吸引国际人才。就在...
    秋宏wendy阅读 936评论 0 0
  • 今天分享一个滤镜制作烟花的特效!温馨提示:燃放烟花污染空气,请减少燃放烟花!想看烟花,用PS制作一份灿烂的烟花,它...
    合小沫阅读 1,997评论 10 57
  • 昨天爸妈到了北京,我去火车站接人,下午一直非常疲惫,晚上出去吃了顿火锅就回家吃饭了,回去之后暖气不热开的空调,一晚...
    兆之阅读 185评论 0 0

友情链接更多精彩内容