Home > PHP Framework > Swoole > What should I do if swoole phpinfo() does not display?

What should I do if swoole phpinfo() does not display?

爱喝马黛茶的安东尼
Release: 2019-12-12 10:48:25
Original
4171 people have browsed it

What should I do if swoole phpinfo() does not display?

1. Problem description

Written a php file test.php, the code is as follows:

<?php
    echo phpinfo();
?>
Copy after login

The browser visited it, but returned NULL.

2. Problem location and solution

After checking online, the problem encountered by most people is actually short_open_tags problem. Their code is as follows:

<?
    echo phpinfo();
?>
Copy after login

In this case, you need to open short_open_tags in php.ini, and then reload the php.ini service and it will be OK.

There are two more questions here. One is how to know which php.ini file is loaded by php execution. You can execute it on the command line: php --ini to find the php.ini file; the other is how to Reload the php.ini file. If php-fpm is enabled on your server, generally speaking, restarting php-fpm will be OK. The command is: service php-fmp restart. If the php-fpm service is not enabled (earlier version) php), generally restarting the apache service is OK, the command is service httpd restart.

After following the above steps, the problems encountered by most people will be solved, but this is other people's problems, not mine orz...

Helpless, I felt that this thing must be related to the configuration of php, so I went to the official website to read the php.ini document. The following configuration is as follows:

disable_functions string
Copy after login

This command Allows you to disable certain functions for security reasons. Accepts a comma separated list of function names as arguments. disable_functions is not affected by safe mode. This directive can only be set in php.ini. For example, it cannot be set in httpd.conf

, which means that some methods can be configured in php.ini, but these methods cannot be called. Open php.ini to find this configuration. Sure enough, the phpinfo() method is disabled. As follows:

disable_functions = phpinfo,system,proc_open,proc_close,show_source,popen,pclose
Copy after login

It suddenly dawned on me that I temporarily deleted the phpinfo() method from disable_functions, reloaded the php.ini file, and then accessed test.php from the browser again. This time it was successful. Problem solve. However, I would like to remind my friends that phpinfo() is very sensitive information. It is usually best not to expose it to the client, so I quickly turned it off after the test.

PHP Chinese website has a large number of free Swoole introductory tutorials, everyone is welcome to learn!

The above is the detailed content of What should I do if swoole phpinfo() does not display?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template