我一直在尝试让php-fpm(w nginx)与默认端口(9000)一起使用,但它不起作用。我正在尝试使用php 7.1(也尝试过7.0和5.6)。服务启动正常,我也可以在ss / netstat中看到端口已打开并正在监听。php-fpm日志中没有错误。最初,我认为这可能是nginx的问题,但是当我尝试使用cgi-fcgi -bind -connect 127.0.0.1:9000直接测试连接时,它只是没有响应,最终出现了无法连接的错误。该请求不会记录在访问日志中(启用访问日志时)。
# cgi-fcgi -bind -connect 127.0.0.1:9000
Could not connect to 127.0.0.1:9000
Run Code Online (Sandbox Code Playgroud)
在重新启动后的某些时候,它只是随机地处理几个请求(有时1个请求,有时10个,变化),然后又停止工作。处于php-fpm状态的请求数不再增加。它的行为没有韵律或节奏,即使对于少数几个请求,我也找不到一致的方法来使它工作。
这个问题困扰了我两天了,它与日志中的任何内容都不一致。请帮忙。感谢您的提前答复。
我到目前为止尝试过的-
下面的信息和配置
作业系统-CentOS 7
PHP-FPM服务状态
#service php-fpm status
Redirecting to /bin/systemctl status php-fpm.service
* php-fpm.service - The PHP FastCGI Process Manager
Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
Active: active (running) since Sun 2017-04-16 …Run Code Online (Sandbox Code Playgroud) 这是一般的PHP问题,而不仅仅是oscommerce.
在旧版本的oscommerce中,通过创建PHP类的对象来显示列.如果我包括它,它会显示出来
new infoBox2($info_box_contents) ;
Run Code Online (Sandbox Code Playgroud)
但是在新版本中,由于很多原因,我没有这样做的自由.我必须返回通过创建上述对象生成的所有HTML代码作为字符串.这就是现在的字符串 -
$data = '<div class="ui-widget infoBoxContainer">' .' <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_CATEGORIES_BOX_TITLE . '</div>' .' <div class="ui-widget-content infoBoxContents">' . $categories_string . '</div>' .'</div>';
Run Code Online (Sandbox Code Playgroud)
您可以注意到它是预定义的HTML代码.我需要将$ data值更改为创建对象时生成的动态生成的HTML代码.关于如何做到这一点的任何想法?我尝试将对象类型转换为字符串并使用var_dump
var_dump给出了这样的东西
object(infoBox2)#8 (7) { ["table_border"]=> string(1) "0" ["table_width"]=> string(4) "100%" ["table_cellspacing"]=> string(1) "0" ["table_cellpadding"]=> string(1) "0" ["table_parameters"]=> string(22) " class="infoBox_table"" ["table_row_parameters"]=> string(0) "" ["table_data_parameters"]=> string(19) " class="infoBox_td"" }
Run Code Online (Sandbox Code Playgroud)
这不完全是它的HTML代码.
这里最重要的是将PHP代码生成的HTML代码作为字符串.如何做到这一点?
如果我将新对象创建放在一个单独的文件中并使用file_get_contents,那么它将返回PHP代码本身,还是会返回php生成的HTML代码.请注意,我将传递文件路径而不是URL.我无法传递URL,因为oscommerce内部我现在不会深入了解.我会用这样的东西: -
file_get_contents("myfile.php");
Run Code Online (Sandbox Code Playgroud)
不
file_get_contents("http://mywebsite.com/myfile.php");
Run Code Online (Sandbox Code Playgroud)