php artisan serve throws errors when zlib activated - php

I noticed a strange behaviour in my local development machine.
I'm developing a Laravel/VueJS based application.
My system:
Ubuntu 18.04.3
Laravel 5.5.44
PHP 7.3.12
After having launched the dev server with the usual php artisan serve, it's impossible to connect to the app on localhost:8000.
The app is only partially loaded. The html seems to load but the assets (css, js) are not. I get loads of net::ERR_INVALID_HTTP_RESPONSE on Chrome console but no errors at all in the artisan console.
On the other hand, the problem is solved when I launch the server with php -S localhost:8000 -t public.
I discovered that the problem seems related to the zlib php library. When it's activated, artisan trhows errors, otherwise everything works flawlessly.
I can work it out, but I'd like to understand why I get this strange behaviour.
EDIT
I attach the messages from Google Chrome console.
Failed to load resource: net::ERR_INVALID_HTTP_RESPONSE FD_logo_white_text.png:1
Failed to load resource: net::ERR_INVALID_HTTP_RESPONSE FD_logo.png:1
Failed to load resource: net::ERR_INVALID_HTTP_RESPONSE app.js:1
Failed to load resource: net::ERR_INVALID_HTTP_RESPONSE app.css:1
Uncaught TypeError: Cannot read property 'init' of undefined (index):1
at (index):1
Failed to load resource: net::ERR_INVALID_HTTP_RESPONSE white-arrow.png:1
Failed to load resource: net::ERR_INVALID_HTTP_RESPONSE 7.jpg:1
Failed to load resource: net::ERR_INVALID_HTTP_RESPONSE 4.jpg:1
Failed to load resource: net::ERR_INVALID_HTTP_RESPONSE manifest.json:1
Moreover, here is a screenshot of the Network tab on Google Console.

Related

/laravel/framework/src/Illuminate/Database/MySqlConnection.php): failed to open stream: No such file or directory

I saw that MySqlConnection.php is missing from the folder shown in the error. Inspect console shows this - Failed to load resource: the server responded with a status of 500 (Internal Server Error). I am running this locally on Ubuntu 20
Do I have to create a MySqlconnection.php file ?
PLease help...thank you...

How do I resolve file permissions issue in laravel sail

Every time I go to http://localhost on my browser, after running ./vendor/bin/sail up,
I keep getting this error
ErrorException
file_put_contents(C:\wamp64\www\catholic_group_of_schools_entrance_platform\storage\framework/sessions/NMNV89ihi6pcYr140olVDp7iPx4ed2ML4Eh8ik7q): Failed to open stream: No such file or directory

Magento 2 Install Windows Admin Broken Links

I use XAMPP on Windows 10. I installed Magento 2.20 community. My admin URLs are all broken:
Is there another version I should use? I tried to run the commands from this post:
Magento 2 - Links in Admin wont work
In my console, I see these errors:
/Magento2/pub/static/version1559572638/adminhtml/Magento/backend/en_US/extjs/resources/css/ytheme-magento.css:1 Failed to load resource: net::ERR_CONNECTION_RESET
/Magento2/pub/static/version1559572638/adminhtml/Magento/backend/en_US/extjs/resources/css/ext-all.css:1 Failed to load resource: net::ERR_CONNECTION_RESET
require.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
(index):1 Refused to apply style from 'http://localhost/Magento2/pub/static/version1559572638/adminhtml/Magento/backend/en_US/jquery/jstree/themes/default/style.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
mixins.js:1 Failed to load resource: the server responded with a status of 404 (Not Found)
requirejs-config.js:71 Uncaught TypeError: require is not a function
at requirejs-config.js:71
at requirejs-config.js:78
at requirejs-config.js:416
magento-icon.svg:1 Failed to load resource: the server responded with a status of 404 (Not Found)
(index):38 Uncaught TypeError: require.config is not a function
at (index):38
(index):87 Uncaught TypeError: require is not a function
at (index):87
(index):295 Uncaught TypeError: require is not a function
at (index):295
(index):428 Uncaught TypeError: require is not a function
at (index):428
(index):473 Uncaught TypeError: require is not a function
at (index):473
(index):514 Uncaught TypeError: require is not a function
at (index):514
(index):537 Uncaught TypeError: require is not a function
at (index):537
(index):560 Uncaught TypeError: require is not a function
at (index):560
admin-icons.woff2:1 Failed to load resource: the server responded with a status of 404 (Not Found)
opensans-400.woff2:1 Failed to load resource: the server responded with a status of 404 (Not Found)
opensans-600.woff2:1 Failed to load resource: the server responded with a status of 404 (Not Found)
opensans-700.woff2:1 Failed to load resource: the server responded with a status of 404 (Not Found)
admin-icons.woff:1 Failed to load resource: the server responded with a status of 404 (Not Found)
opensans-700.woff:1 Failed to load resource: the server responded with a status of 404 (Not Found)
admin-icons.ttf:1 Failed to load resource: the server responded with a status of 404 (Not Found)
opensans-600.woff:1 Failed to load resource: the server responded with a status of 404 (Not Found)
opensans-400.woff:1 Failed to load resource: the server responded with a status of 404 (Not Found)
opensans-700.ttf:1 Failed to load resource: the server responded with a status of 404 (Not Found)
opensans-600.ttf:1 Failed to load resource: the server responded with a status of 404 (Not Found)
opensans-400.ttf:1 Failed to load resource: the server responded with a status of 404 (Not Found)
I run Magento 2 on Windows (for development) successfully although I use WAMP. My recipe for setting it up is as follows (I adapted it from another stackexchange Q&A but can't find it). Note my locale is en_GB, replace yours below:
Run grunt clean which will clean several of the folders below quickly (*)
*delete var/cache
*delete var/view_preprocessed
*delete pub/static/* (don't delete the .htaccess)
delete generated/* and not .htaccess
delete var/composer_home
run php bin/magento cache:flush
run php bin/magento setup:static-content:deploy --theme YOUR/theme en_GB [en_GB is essential]
run php bin/magento setup:static-content:deploy --theme Magento/backend en_GB [en_GB is essential]
delete all themes/languages you don't actually use from pub/static/frontend
run php bin/magento dev:source-theme:deploy --locale="en_GB" --theme="YOUR/theme" css/styles-m css/styles-l css/email css/email-inline
grunt commands below need to be run as administrator
Copy a valid dev\tools\grunt\configs\theme.js that contains the theme definition if you’ve done an upgrade (as it gets overwritten)
DO NOT run grunt exec at all
run grunt less:yourtheme (and probably :backend)
Doesn't know whether the following will help you out, Please check.
In your screen shot i can see that you are already in magento/bin path, so here you have to run below command
sudo magento setup:upgrade
And for second command yo are using two php in command.
First Note : Magento2 doesn't support in windows version. But, can run.
If you are installing magento2.2 please make sure you are using php7 or 7x, magento2.2 will not support older versions.
Check your apache2 a2enmode is enabled or not, because it will make issues on redirection.
Check your all files have enough permission to load, for your local you can check with giving full permission for app/etc,var/,pub/static/,generate/*.
Once everything is set try to run the deployment commands with php.
You can avoid sudo if not needed. Or else go to magento root and run the earlier command which you already tried to implement.
Hope this will help you to sort out.

PHPUnit: error when including Predis\ClientInterface.php

I am adding record via browser in redis cache with predis class it added and no error getting.
When executing from PHPUnit I get the next error:
PHPUnit_Framework_Exception: include_once(Predis\ClientInterface.php): failed to open stream: No such file or directory
However same application, same unit test,same configuration works fine in my colleague's machine.

Codeception code coverage - file_get_contents exception (c3/report/clear)

I'm using Codeception with Laravel 4. In particular I'm trying to use remote code coverage so that I can include acceptance testing in the code coverage results.
XDebug with remote_enable are configured, and c3.php is installed and included in 'public/index.php'.
On Windows everything works as expected. But on Ubuntu 12.04 LTS (with PHP5.4) I get this exception:
[ErrorException] file_get_contents(http://localhost/c3/report/clear):
failed to open stream: HTTP request failed! HTTP/1.1 500 Internal Server Error
What am I doing wrong?
This was easy to fix. There was an error in the path when including c3.php from index.php. The Apache error log made this clear.

Categories