mirasvit / module-profiler

Magento 2 Profiler
https://mirasvit.com/
Open Software License 3.0
133 stars 36 forks source link

Warning: file_put_contents(/profiler/*.meta): #21

Closed webtekindo closed 6 years ago

webtekindo commented 7 years ago

We are using Magento 2.2 (on Windows with Wamp PHP 7.0.10) but the problem also start to happen recently on a Magento 2.1 install it was working fine before.

When the profiler is enable at the bottom of the page we see:

Fatal error: Uncaught Exception: Warning: file_put_contents(C:/www/magento2rendy/var/profiler/2017-09-28 11:58:07.081800.meta): failed to open stream: Invalid argument in C:\www\magento2rendy\vendor\mirasvit\module-profiler\src\Profiler\Model\Storage.php on line 48 in C:\www\magento2rendy\vendor\magento\framework\App\ErrorHandler.php on line 61

Our /var/profiler/ folder is empty.

Same when we use the command bin/magento mirasvit:profiler:enable:

`Fatal error: Uncaught Exception: Warning: file_put_contents(C:/www/magento2rendy/var/profiler/2017-09-28 11:54:55.613000.meta): failed to open stream: Invalid argument in C:\www\magento2rendy\vendor\mirasvit\module-profiler\src\Profiler\Model\Storage.php on line 48 in C:\www\magento2rendy\vendor\magento\framework\App\ErrorHandler.php:61 Stack trace:

0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'file_put_conten...', 'C:\www\magento2...', 48, Array)

1 C:\www\magento2rendy\vendor\mirasvit\module-profiler\src\Profiler\Model\Storage.php(48): file_put_contents('C:/www/magento2...', 'RESPONSE_CODE: ...')

2 C:\www\magento2rendy\vendor\mirasvit\module-profiler\src\Profiler\Model\Driver\Output\Html.php(39): Mirasvit\Profiler\Model\Storage->dump()

3 C:\www\magento2rendy\vendor\magento\framework\Profiler\Driver\Standard.php(195): Mirasvit\Profiler\Model\Driver\Output\Html->display(Object(Magento\Framework\Profiler\Driver\Standard\Stat))

4 [internal function]: Magento\Framework\Profiler\Driver\Standard- in C:\www\magento2rendy\vendor\magento\framework\App\ErrorHandler.php on line 61`

And then profiler is not shown.

Can you help us solve this issue?

adrok commented 7 years ago

Please check, that folder C:/www/magento2rendy/var/profiler/ have correct write permissions.

webtekindo commented 7 years ago

That's the first thing I checked before to post, we are using WAMP on Windows shouldn't be a problem of permission, but I put "Full Control" access to the folder /var/profiler and still same problem.

webtekindo commented 7 years ago

image

adrok commented 7 years ago

Probably this issue related with file name. Please try manually create file with name 2017-09-28 11:54:55.613000.meta

webtekindo commented 7 years ago

I create the file name as you mention, but still same error.

Just to mention it was working fine before, but after an upgrade of Mirasvit Profiler with composer (around version 1.0.2 or above), the error start to show up.

webtekindo commented 7 years ago

Oh actually when i create the file manually:

2017-09-28 11:54:55.613000.meta

On windows file name character : is not allowed so I end up with:

2017-09-28 115455.613000.meta

that's probably the problem!

Any workaround to make it work on WIndows?

webtekindo commented 7 years ago

I replace: $name = $dt->format('Y-m-d H:i:s.u'); by $name = $dt->format('Y-m-d His.u'); and now it works.

Hope you can include a fix on the git repository. Thanks for your help!

webtekindo commented 7 years ago

Another very small issue but not a problem at all, somehow I never had the small icon (Font Awesome) displayed on my screen.

image

gediminaskv commented 6 years ago

I get quite similar error. My environment: Mage 2.2.2, PHP7, Centos6. /var/profile/ is writeable. What is interesting that extension is currently disabled. Even though PHP shows:

PHP Fatal error: Uncaught Exception: Warning: file_get_contents(/home/[domain]/public_html/var/profiler//.prof): failed to open stream: No such file or directory in /home/[domain]/public_html/vendor/mirasvit/module-profiler/src/Profiler/Model/Storage.php on line 63 in /home/[domain]/public_html/vendor/magento/framework/App/ErrorHandler.php:61\nStack trace:\n#0 [internal function]: Magento\Framework\App\ErrorHandler->handler(2, 'file_get_conten...', '/home/[domain]...', 63, Array)\n#1 /home/[domain]/public_html/vendor/mirasvit/module-profiler/src/Profiler/Model/Storage.php(63): file_get_contents('/home/[domain]...')\n#2 /home/[domain]/public_html/vendor/mirasvit/module-profiler/src/Profiler/Block/Context.php(29): Mirasvit\Profiler\Model\Storage->load(NULL)\n#3 /home/[domain]/public_html/vendor/mirasvit/module-profiler/src/Profiler/Block/Toolbar.php(45): Mirasvit\Profiler\Block\Context->getProfi in /home/[domain]/public_html/vendor/magento/framework/App/ErrorHandler.php on line 61, referer: http://[domain]/admin_dev/admin/system_config/edit/section/general/key/e74dcff2a30eab35e98a12dcf7341e825257ec56663aa684af549f31ca31edc7/