Closed vieyahn2017 closed 4 years ago
Windows下PHP7.2的安装、配置和初体验
https://blog.csdn.net/Jeffid/article/details/83452528
Composer 下载地址
下载并安装Composer
使用原镜像地址可能会比较缓慢,可以使用 阿里云 composer 镜像官网地址,使用方式参考:https://learnku.com/php/t/30716
Composer安装 "Failed to decode zlib stream" when install
= In windows, change zlib.output_compression=Off to on in php.ini file good luck
阿里云 composer 镜像官网地址 一、全局配置(推荐) 所有项目都会使用该镜像地址: composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/ 取消配置: composer config -g --unset repos.packagist
进入后端根目录,运行命令 composer install 安装依赖
装PHP Redis扩展,注意选择合适当前php版本的扩展
将压缩包中的php_redis.dll和php_igbinary.dll文件放入PHP目录下的ext目录
编辑php.ini, 最后加入两行
extension=php_igbinary.dll
extension=php_redis.dll
/downloads/pecl/releases/redis/5.0.0rc1/php_redis-5.0.0rc1-7.2-ts-vc15-x64.zip
/downloads/pecl/releases/igbinary/3.0.1/php_igbinary-3.0.1-7.2-ts-vc15-x64.zip
php -S localhost:9000 -t D:\php\pearProjectApi-master
利用PHP内置的服务器我们可以很方便地将开发项目跑起来,而这只需要一条命令即可实现。整个命令是 php -S localhost:9000 -t d:\code\lv56\public,-S后接的是服务器地址和端口,-t后面接的是项目的入口目录
composer install
composer install
Deprecation warning: Your package name pearProject is invalid, it should have a
vendor name, a forward slash, and a package name. The vendor and package name ca
n be words separated by -, . or _. The complete name should match "[a-z0-9]([_.-
]?[a-z0-9]+)*/[a-z0-9]([_.-]?[a-z0-9]+)*". Make sure you fix this as Composer 2.
0 will error.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 39 installs, 0 updates, 0 removals
- Installing topthink/think-installer (v2.0.0): Downloading (100%)
- Installing zoujingli/ip2region (dev-master 5bde0b1): Downloading (connecting
Downloading (100%)
- Installing firebase/php-jwt (v5.0.0): Downloading (100%)
- Installing symfony/polyfill-mbstring (v1.12.0): Downloading (100%)
- Installing symfony/polyfill-php72 (v1.12.0): Downloading (100%)
- Installing symfony/polyfill-intl-idn (v1.12.0): Downloading (100%)
- Installing symfony/mime (v4.3.4): Downloading (100%)
- Installing symfony/http-foundation (v4.3.4): Downloading (100%)
- Installing symfony/var-exporter (v4.3.4): Downloading (100%)
- Installing psr/container (1.0.0): Downloading (100%)
- Installing symfony/service-contracts (v1.1.6): Downloading (100%)
- Installing psr/cache (1.0.1): Downloading (100%)
- Installing symfony/cache-contracts (v1.1.5): Downloading (100%)
- Installing psr/log (1.1.0): Downloading (100%)
- Installing symfony/cache (v4.3.4): Downloading (100%)
- Installing psr/simple-cache (1.0.1): Downloading (100%)
- Installing monolog/monolog (1.25.1): Downloading (100%)
- Installing pimple/pimple (v3.2.3): Downloading (100%)
- Installing guzzlehttp/promises (v1.3.1): Downloading (100%)
- Installing ralouphie/getallheaders (3.0.3): Downloading (100%)
- Installing psr/http-message (1.0.1): Downloading (100%)
- Installing guzzlehttp/psr7 (1.6.1): Downloading (100%)
- Installing guzzlehttp/guzzle (6.3.3): Downloading (100%)
- Installing overtrue/http (1.1.2): Downloading (100%)
- Installing mingyoung/dingtalk (2.0.0): Downloading (100%)
- Installing qiniu/php-sdk (v7.2.9): Downloading (100%)
- Installing symfony/options-resolver (v3.4.31): Downloading (100%)
- Installing endroid/qr-code (1.9.3): Downloading (100%)
- Installing topthink/framework (v5.1.38.1): Downloading (100%)
- Installing aliyuncs/oss-sdk-php (v2.3.0): Downloading (100%)
- Installing topthink/think-image (v1.0.7): Downloading (100%)
- Installing workerman/workerman-for-win (v3.5.1): Downloading (connecting...)
Downloading (100%)
- Installing workerman/gateway-worker-for-win (v3.0.7): Downloading (connectin
Downloading (100%)
- Installing workerman/workerman (v3.5.22): Downloading (100%)
- Installing workerman/gateway-worker (v3.0.13): Downloading (100%)
- Installing overtrue/easy-sms (1.1.18): Downloading (100%)
- Installing markbaker/complex (1.4.7): Downloading (100%)
- Installing phpoffice/phpspreadsheet (1.5.2): Downloading (100%)
- Installing phpmailer/phpmailer (v6.1.1): Downloading (100%)
symfony/polyfill-intl-idn suggests installing ext-intl (For best performance)
symfony/service-contracts suggests installing symfony/service-implementation
monolog/monolog suggests installing graylog2/gelf-php (Allow sending log message
s to a GrayLog2 server)
monolog/monolog suggests installing sentry/sentry (Allow sending log messages to
a Sentry server)
monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages
to a CouchDB server)
monolog/monolog suggests installing ruflin/elastica (Allow sending log messages
to an Elastic Search server)
monolog/monolog suggests installing php-amqplib/php-amqplib (Allow sending log m
essages to an AMQP server using php-amqplib)
monolog/monolog suggests installing ext-amqp (Allow sending log messages to an A
MQP server (1.0+ required))
monolog/monolog suggests installing ext-mongo (Allow sending log messages to a M
ongoDB server)
monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages
to a MongoDB server via PHP Driver)
monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages
to AWS services like DynamoDB)
monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages
to Rollbar)
monolog/monolog suggests installing php-console/php-console (Allow sending log m
essages to Google Chrome)
guzzlehttp/psr7 suggests installing zendframework/zend-httphandlerrunner (Emit P
SR-7 responses)
workerman/workerman suggests installing ext-event (For better performance. )
phpoffice/phpspreadsheet suggests installing mpdf/mpdf (Option for rendering PDF
with PDF Writer)
phpoffice/phpspreadsheet suggests installing dompdf/dompdf (Option for rendering
PDF with PDF Writer)
phpoffice/phpspreadsheet suggests installing tecnickcom/tcpdf (Option for render
ing PDF with PDF Writer)
phpoffice/phpspreadsheet suggests installing jpgraph/jpgraph (Option for renderi
ng charts, or including charts with PDF or HTML Writers)
phpmailer/phpmailer suggests installing league/oauth2-google (Needed for Google
XOAUTH2 authentication)
phpmailer/phpmailer suggests installing hayageek/oauth2-yahoo (Needed for Yahoo
XOAUTH2 authentication)
phpmailer/phpmailer suggests installing stevenmaguire/oauth2-microsoft (Needed f
or Microsoft XOAUTH2 authentication)
Writing lock file
Generating autoload files
最完美解决Nginx部署ThinkPHP项目的办法 https://www.cnblogs.com/mracale/p/9034587.html
通用写法
server {
...
location / {
index index.htm index.html index.php;
#访问路径的文件不存在则重写URL转交给ThinkPHP处理
if (!-e $request_filename) {
rewrite ^/(.*)$ /index.php/$1 last;
break;
}
}
location ~ \.php/?.*$ {
root /var/www/html/website;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#加载Nginx默认"服务器环境变量"配置
include fastcgi.conf;
#设置PATH_INFO并改写SCRIPT_FILENAME,SCRIPT_NAME服务器环境变量
set $fastcgi_script_name2 $fastcgi_script_name;
if ($fastcgi_script_name ~ "^(.+\.php)(/.+)$") {
set $fastcgi_script_name2 $1;
set $path_info $2;
}
fastcgi_param PATH_INFO $path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name2;
fastcgi_param SCRIPT_NAME $fastcgi_script_name2;
}
}
其实应该使用更简单的方法,fastcgi模块自带了一个fastcgi_split_path_info指令专门用来解决此类问题的,
该指令会根据给定的正则表达式来分隔URL,从而提取出脚本名和path info信息,使用这个指令可以避免使用if语句,配置更简单。 另外判断文件是否存在也有更简单的方法,使用try_files指令即可。
server {
...
location / {
index index.htm index.html index.php;
#如果文件不存在则尝试TP解析
try_files $uri /index.php$uri;
}
location ~ .+\.php($|/) {
root /var/www/html/website;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
#设置PATH_INFO,注意fastcgi_split_path_info已经自动改写了fastcgi_script_name变量,
#后面不需要再改写SCRIPT_FILENAME,SCRIPT_NAME环境变量,所以必须在加载fastcgi.conf之前设置
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
#加载Nginx默认"服务器环境变量"配置
include fastcgi.conf;
}
}
分类: All kinds
php7 下安装并使用xhprof性能分析工具 2018-05-20 13:54:38 无风的雨 阅读数 899更多 分类专栏: Linux PHP 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 本文链接:https://blog.csdn.net/guyan0319/article/details/80380378 Xhprof是facebook开源出来的一个php轻量级的性能分析工具,跟Xdebug类似,但性能开销更低,还可以用在生产环境中,也可以由程序开关来控制是否进行profile。
因为那个pear是php开发的后台