在cywin64 的包管理器中 Devel開發類包中勾選需要安裝 的
gcc、make、autoconf php-devel php-pear httpd-devel 等包
問題:
-bash: pecl: command not found
解決方案:
php-devel php-pear httpd-devel
pecl install igbinary
pecl install lzf
pecl install zstd
pecl install redis
Cygwin安裝nginx并設置為Windows服務:
1,在cygwin下搜索nginx并安裝(不建議編譯安裝,官方有封裝好服務),安裝cygrunsrv(設置Windows服務的基礎),安裝好后 以管理員身份運行Cygwin nginx服務文件為/etc/rc.d/init.d/nginx,在Cygwin下是可執行程序: /etc/rc.d/init.d/nginx Usage: /etc/rc.d/init.d/nginx {start|stop|status|install|uninstall|restart|condrestart}
2,執行cygserver-config并輸入yes接受默認值即可,然后執行如下命令:/etc/rc.d/init.d/nginx install
Installing nginx daemon: done.
3,創建必要的文件夾/var/log/nginx和/var/lib/nginx/tmp,然后執行/etc/rc.d/init.d/nginx start即可啟動服務,結束!
Cygwin安裝php-fpm并設置為Windows服務:
執行上述操作后,執行如下命令:/etc/rc.d/init.d/php-fpm install, 然后執行/etc/rc.d/init.d/nginx start即可啟動服務
/etc/rc.d/init.d/php-fpm restart
PHP擴展ini目錄:
/etc/php.d
PHP擴展目錄:
/lib/php/20180731
NGINX配置文件路徑:/etc/nginx/nginx.conf
Composer安裝:
在用 apt-cyg install unzip php php-json php-iconv php-phar php-zlib php-mbstring php-xmlwriter php-tokenizer 后,再根據官網的命令行安裝模式,我們再逐步運行以下的下載命令,就能安裝成功了。
php -r "copy('https://getcomposer.org/installer','composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php –install-dir=/bin –filename=composer
php -r "unlink('composer-setup.php');"
Swoole安裝:
phpize
./configure --enable-openssl --with-openssl-dir=/usr/include/openssl
make && make install
PHP PECL 升級遇到unsupported protocol 等等的問題,通常就是需要update-channels,再來執行upgrade 即可。
nginx.conf:
```#user Dell owner;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
# Load dynamic modules
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
listen 80;
server_name localhost www.dp2.cn;
root /home/w7swoole/CRMChat-master/crmchat/public;
index index.html index.htm index.php;
#charset koi8-r;
#access_log logs/host.access.log main;
#配置index.php可以省略的方法,thinkphp經常需要。
location /
{
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
}
}
#配置thinkphp-swoole 方法
location /ws
{
proxy_pass http://127.0.0.1:20108;
proxy_http_version 1.1;
proxy_read_timeout 360s;
proxy_redirect off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
#Set Nginx Cache
add_header Cache-Control no-cache;
expires 12h;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
#root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
}```