在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;
# }
#}
}```