PHP 的错误日志位于 XAMPP 中的什么位置?

发布于 2024-09-19 16:42:35 字数 65 浏览 4 评论 0原文

我一直在使用 Windows 版 XAMPP。

PHP 的错误日志位于 XAMPP 中的什么位置?

I've been using XAMPP for Windows.

Where does PHP's error log reside in XAMPP?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(14

昔梦 2024-09-26 16:42:35

\xampp\apache\logs\error.log,其中 xampp 是您的安装文件夹。
如果您没有更改 PHP 中的 error_log 设置(使用 phpinfo() 检查),它将被记录到 Apache 日志中。

\xampp\apache\logs\error.log, where xampp is your installation folder.
If you haven't changed the error_log setting in PHP (check with phpinfo()), it will be logged to the Apache log.

池木 2024-09-26 16:42:35

我在以下位置找到了它:
\xampp\php\logs\php_error_log

I found it in:
\xampp\php\logs\php_error_log

记忆里有你的影子 2024-09-26 16:42:35

您还可以打开 XAMPP 控制面板,然后单击按钮日志

在此处输入图像描述

You can also open the XAMPP control panel and click on the button Logs:

Enter image description here

写下不归期 2024-09-26 16:42:35

无论出于何种原因, \xampp\php\logs 对我来说根本不存在。

我只需在 \xampp\php\ 中创建一个名为 logs 的文件夹,然后创建并写入 php_error_log 文件。

\xampp\php\logs did not exist at all for me - for whatever reason.

I simply had to create a folder in \xampp\php\ called logs and then the php_error_log file was created and written to.

暗地喜欢 2024-09-26 16:42:35

对于 Mac 用户,XAMPP 版本 1.7.3:

/Applications/XAMPP/xamppfiles/logs/error_log

For Mac users, XAMPP version 1.7.3:

/Applications/XAMPP/xamppfiles/logs/error_log
银河中√捞星星 2024-09-26 16:42:35

对于在 Ubuntu 的 XAMPP 中搜索 PHP 日志文件的人来说,它是:

/opt/lampp/logs/php_error_log

很可能它会很大(我的大约 350 MB),并且当我打开该文件时,它会减慢我的文本编辑器的速度。如果您不关心以前的所有日志,只需转到终端,然后一一写入这三行即可轻松清空文件:

sudo su 
cd /opt/lampp/logs/
> php_error_log

现在,新的日志将可以轻松快速地打开。尖括号清空文件(仅适用于 bash,不适用于 zsh)。

For anyone searching for the PHP log file in XAMPP for Ubuntu, it is:

/opt/lampp/logs/php_error_log

Most probably it will be having a big size (mine was about 350 MBs) and it slowed down my text editor when I opened the file. If you do not care about all the previous logs you can empty the file easily by simply going to the terminal and then writing these three lines one by one:

sudo su 
cd /opt/lampp/logs/
> php_error_log

And newer logs will be easy and fast to open now. The angle bracket empties the file (Works with bash only, doesn't work on zsh).

零度℉ 2024-09-26 16:42:35

查看配置文件并搜索 error_log 设置。或者使用 phpinfo() 来查找此设置。

Look in your configuration file and search for the error_log setting. Or use phpinfo() to find this setting.

妞丶爷亲个 2024-09-26 16:42:35

您可以简单地从 phpMyAdmin 检查日志路径。

运行这个:

http://localhost/dashboard/

现在点击 PHPInfo(右上角),或者您可以简单地在浏览器中打开此 URL:

http://localhost/dashboard/phpinfo.php

现在搜索“error_log”(不带引号)。您将获得日志路径。

You can simply check your log path from phpMyAdmin.

Run this:

http://localhost/dashboard/

Now click PHPInfo (top right corner) or you can simply open this URL in your browser:

http://localhost/dashboard/phpinfo.php

Now search for "error_log"(without quotes). You will get the log path.

坏尐絯℡ 2024-09-26 16:42:35

默认情况下,XAMPP PHP 日志文件路径位于 /xampp_installation_folder/php/logs/php_error_log 中,但我注意到有时它不会自动生成。也许是 Windows 帐户写权限问题?我不确定,但我手动创建了日志文件夹和 php_error_log 文件,然后 PHP 日志最终记录在其中。

By default, the XAMPP PHP log file path is in /xampp_installation_folder/php/logs/php_error_log, but I noticed that sometimes it would not be generated automatically. Maybe it could be a Windows account write permission problem? I am not sure, but I created the logs folder and php_error_log file manually and then PHP logs were logged in it finally.

蓝梦月影 2024-09-26 16:42:35

在我刚刚安装的当前版本 (8.0.11) 中,安装程序“忘记”创建文件夹 C:\xamppp\php\logs,这可能是设计使然,但这就是 ApacheFriends 为您准备的

In the current version I've just installed (8.0.11) the installer "forgets" to create the folder C:\xamppp\php\logs, perhaps by design but that is ApacheFriends for you????. After creating the folder and restarting Apache the folder will be populated with a php_error_log file. No, not a php_error.log but php_error_log, becouse they are your friends.

Follow

Terminal

To keep seeing the last entry (much like *nix sh tail -f) use the following command:

Get-Content c:\xampp\php\logs\php_error_log -Wait

This will keep reading the file and display the last entries. Quite handy if you are debugging.

Code

You might be using vscode so why not have the errors right at you finger tips. Create a file .vscode\tasks.json

{ 
  // See https://go.microsoft.com/fwlink/?LinkId=733558 
  // for the documentation about the tasks.json format 
  "version": "2.0.0", 
  "tasks": [ 
    { 
      "label": "Monitor php errors", 
      "type": "shell", 
      "command": "Get-Content -Wait c:\\xampp\\php\\logs\\php_error_log", 
      "runOptions": { 
        "runOn": "folderOpen" 
      } 
    } 
  ] 

and allow it to run on start. Make sure you work on a folder, not single files, but you were doing that already, weren't you?

╄→承喏 2024-09-26 16:42:35

\xampp\apache\logs\error.log 是 PHP 中错误日志的默认位置。

\xampp\apache\logs\error.log is the default location of error logs in PHP.

少年亿悲伤 2024-09-26 16:42:35

正如前面的答案所说,您可以在Windows中找到PHP错误日志。在C:\xampp\apache\logs\error.log中。您可以通过 tail -f .\error.log 轻松显示最后的日志。

As said in previous answers, you can find the PHP error log in Windows. In C:\xampp\apache\logs\error.log. You can easily display the last logs by tail -f .\error.log.

西瑶 2024-09-26 16:42:35

对于 Mac 用户,可以在以下位置找到:

/Applications/XAMPP/xamppfiles/logs/php_error_log

For Mac users, it can be found in:

/Applications/XAMPP/xamppfiles/logs/php_error_log

话少心凉 2024-09-26 16:42:35

对于我的问题,我必须将日志清零:

sudo bash -c ' > /Applications/XAMPP/xamppfiles/logs/php_error_log '

For my issue, I had to zero out the log:

sudo bash -c ' > /Applications/XAMPP/xamppfiles/logs/php_error_log '

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文