[英]How to refresh changes in swoole PHP
I created one folder with two files, one is index.php and one is Dockerfile and in terminal I run php index.php
and it started on http://127.0.0.1:9501/ , but when I change hello world in something else, it doesn't show new change on that link.. it stays hello world.我创建了一个包含两个文件的文件夹,一个是 index.php,一个是 Dockerfile,在终端中我运行php index.php
它开始于http://127.0.0.1:9501/ ,但是当我用别的东西改变 hello world 时,它没有显示该链接上的新变化..它保持你好世界。 I am trying to learn Swoole and I don't know how to work with this.. Also I created in same folder Dockerfile我正在尝试学习 Swoole,但我不知道如何使用它。我还在同一文件夹中创建了 Dockerfile
index.php index.php
<?php
use Swoole\Http\Server;
use Swoole\Http\Request;
use Swoole\Http\Response;
$server = new Swoole\HTTP\Server("127.0.0.1", 9501);
$server->on("Start", function(Server $server)
{
echo "Swoole http server is started at http://127.0.0.1:9501\n";
});
$server->on("Request", function(Request $request, Response $response)
{
$response->header("Content-Type", "text/plain");
$response->end("Hello World\n");
});
$server->start();
Dockerfile Dockerfile
FROM php:8.1.0-cli
RUN apt-get update && apt-get install vim -y && \
apt-get install openssl -y && \
apt-get install libssl-dev -y && \
apt-get install wget -y && \
apt-get install git -y && \
apt-get install procps -y && \
apt-get install htop -y
RUN cd /tmp && git clone https://github.com/openswoole/swoole-src.git && \
cd swoole-src && \
git checkout v4.11.0 && \
phpize && \
./configure --enable-openssl --enable-swoole-curl --enable-http2 --enable-mysqlnd && \
make && make install
RUN touch /usr/local/etc/php/conf.d/openswoole.ini && \
echo 'extension=openswoole.so' > /usr/local/etc/php/conf.d/zzz_openswoole.ini
RUN wget -O /usr/local/bin/dumb-init https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_amd64
RUN chmod +x /usr/local/bin/dumb-init
RUN apt-get autoremove -y && rm -rf /var/lib/apt/lists/*
ENTRYPOINT ["/usr/local/bin/dumb-init", "--", "php"]
And when I run,当我跑步时,
docker build -f ./Dockerfile -t openswoole-php .
I am not able to build docker image for php-swoole I get error我无法为 php-swoole 构建 docker 图像我收到错误
executor failed running [/bin/sh -c cd /tmp && git clone https://github.com/openswoole/swoole-src.git && cd swoole-src && git checkout v4.11.0 && phpize && ./configure --enable-openssl --enable-swoole-curl --enable-http2 --enable-mysqlnd && make && make install]: exit code: 2
I found solution to stop the web server, press Control+C
.我找到了停止 web 服务器的解决方案,请按Control+C
。 And again run php index.php
再次运行php index.php
I've found two ways to refresh PHP content:我找到了两种刷新 PHP 内容的方法:
echo ("<meta http-equiv='refresh' content='1'>"); //Refresh by HTTP 'meta'
使用 HTML 元标记: echo ("<meta http-equiv='refresh' content='1'>"); //Refresh by HTTP 'meta'
echo ("<meta http-equiv='refresh' content='1'>"); //Refresh by HTTP 'meta'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.