douzhi3105
2014-11-08 22:46
浏览 51
已采纳

终端和浏览器之间的不同php结果

My server is running php-fpm with nginx. I had applied these permissions.

sudo chgrp -R www-data /usr/share/nginx/html
sudo chmod -R g+rw /usr/share/nginx/html
sudo chmod g+s /usr/share/nginx/html

I have this code.

if(function_exists("my_void_function")){

    echo "exist";

}else{
    echo "none exist";
}

I am getting different result that simple code. you can see screenshot of my pc from this image.

php different result terminal and browser

图片转代码服务由CSDN问答提供 功能建议

我的服务器正在运行带有nginx的php-fpm。 我已经应用了这些权限。

  sudo chgrp -R www-data / usr / share / nginx / html 
sudo chmod -R g + rw / usr / share / nginx /  html 
sudo chmod g + s / usr / share / nginx / html 
   
 
 

我有这段代码。

  if(function_exists(“my_void_function”)){
 
 echo“exists”; 
 
} else {
 echo“none exist”; 
} 
   
  
 

我得到的结果就是简单的代码。 你可以从这张图片看到我的电脑的截图。

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dqouryz3595 2014-11-08 23:04
    已采纳

    As you have added the function via a custom extension, you must load the extension with the respective php.ini file of the PHP engine. PHP CLI has a different php.ini than PHP-FPM/mod_php.

    Also, after changing php.ini of PHP-FPM, you must restart the PHP-FPM service (usually sudo service php-fpm restart on Debian-like systems). Those who are using mod_php with Apache need to restart the Apache service.

    点赞 评论

相关推荐 更多相似问题