简体   繁体   English

如何在处理文件时解决“ 500 Internal Server Error”?

[英]How to fix '500 Internal Server Error' while file handling?

I had made a PHP file using fopen and fwrite and I am trying to execute that file but it's giving me 我已经使用fopen和fwrite制作了一个PHP文件,我正在尝试执行该文件,但这给了我

Internal Server Error 内部服务器错误

while making file I had to change the permission to 0775 using chmod 在制作文件时,我不得不使用chmod将权限更改为0775

$book="829310_Revolution_Test_(5)-converted_(4).epub.php";  
$book=str_replace(" ","_",$book);
$path=$book.".php";
$myfile =fopen("../../include/uploaded/epub/$path", "w") or die("Unable to open file!");
$txt = "<?php include('hello.php'); ?>";
fwrite($myfile, $txt);
fclose($myfile);
chmod("../../include/uploaded/epub/$book", 0775);
chmod("../../include/uploaded/epub/$path", 0775);

I want user can execute this file but while trying to execute this file I am getting an Internal Server Error. 我希望用户可以执行此文件,但是在尝试执行此文件时出现内部服务器错误。

To know exact errors you should turn on the error reporting by adding following lines at the top of your php file: 要了解确切的错误,您应该通过在php文件顶部添加以下几行来打开错误报告:

ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);

For more info on error reporting, check this page . 有关错误报告的更多信息, 请检查此页面

Once you get exact error, you can easily debug the server error. 一旦获得确切的错误,就可以轻松调试服务器错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用Ajax将数据插入数据库时​​如何修复500 Internal Server Error - How to fix 500 Internal Server Error while inserting the data in the database using Ajax 错误处理,500内部服务器错误 - Error handling, 500 internal server error 如何修复 Prestashop 前台,500 内部服务器错误? - How to fix Prestashop front office, 500 internal server error? Laravel 4-如何在所有子域中修复内部服务器错误500 - Laravel 4 - How to fix Internal Server Error 500 in all subdomains 如何修复 500(内部服务器错误)Vue js - Laravel(已编辑) - How to fix 500 (Internal Server Error) Vue js - Laravel (Edited) 如何使用 laravel 修复 postman 中的 500 个内部服务器错误 - how to fix 500 internal server error in postman using laravel 使用curl时出现500 Internal Server Error - 500 Internal Server Error while using curl While循环导致500内部服务器错误 - While Loop causing 500 Internal Server error 错误文件.htaccess 500内部服务器错误 - error file .htaccess 500 Internal Server Error 我该如何处理500个内部服务器错误? 我在运行时需要一个错误/异常处理选项。 - How can i handle a 500 internal server error ? I need an error/ exception handling option for this on runtime.?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM