composer包管理器安装
https://getcomposer.org/Composer-Setup.exe
集成环境
- phpstudy --> 小皮
- phpenv
TP的安装
修改为国内的阿里云源:
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer
cd D:\Develop\phpstudy_pro\WWW
composer create-project topthink/think www.tp.com
- 要求php版本不低于php8
Cannot use topthink/think’s latest version v8.0.0 as it requires php >=8.0.0 which is not satisfied by your platform.
- 当升级到PHP8版本时,可能会出现如下报错:
Fatal error: Directive 'track_errors' is no longer available in PHP in Unknown on line 0
解决办法:
track_errors=off
或者删除该行
- The openssl extension is required for SSL/TLS protection but is not available. If you can not enable the openssl ex tension, you can disable this error, at your own risk, by setting the ‘disable-tls’ option to true.
- 配置ssl扩展,编辑php.ini文件,加入下面两行
extension_dir=ext
extension=php_openssl.dll
- Alternatively, you can run Composer with
--ignore-platform-req=ext-fileinfo
to temporarily ignore these required extensions.
composer create-project topthink/think www.tp.com --ignore-platform-req=ext-fileinfo
或者在php.ini配置:
extension=php_fileinfo.dll
- 访问网站时报错:You don’t have permission to access / on this server.
解决办法:需要配置到public这一层级:
D:/Develop/phpstudy_pro/WWW/www.tp.com/public