Laravel 5.4, no luck with Homestead - laravel

Everytime I try to install Homestead on 5.4, I cannot. Here is the error message I get from the terminal. I have tried to look at the path, but I see no issues. Aside from this, I have no clue what to do. Any troubleshooting tips would be appreciated.
link to issue (picture)

Two ways to fix this
Disable tls composer config -g -- disable-tls true - not recommended
Enable the openssl extension in your php.ini file extension=php_openssl.so

Related

How to fix "https://repo.packagist.org/packages.json does not contain valid Json"?

I've an issue with composer running on a vagrantbox (Centos 7), which started to just suddenly happen.
I've already tried manually running the command/solution mentioned on the link below but to no avail.
(To clarify, i'm using vagrant not docker, but it was the closest question i found to my situation. Most of the information i found are related to composer.json not being valid, but here is packagist.org/packages.json which, is currently valid)
Composer not working in docker container: "https://packagist.org/packages.json" does not contain valid JSON
Here are the details of the issue.
While running composer update on terminal i get:
composer update
[Seld\JsonLint\ParsingException]
"https://repo.packagist.org/packages.json" does not contain valid JSON
Parse error on line 1:
^
Expected one of: 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '['
And when running composer install also on terminal every package returns this:
Failed to download psr/cache from dist: "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8"
appears broken, and returned an empty 200 response
Now trying to download from source
When running composer config --global repo.packagist composer packagist.org
the results are now
composer update
Loading composer repositories with package information
[Composer\Downloader\TransportException]
Your configuration does not allow connections to http://repo.packagist.org/packages.json. See https://getcomposer.o
rg/doc/06-config.md#secure-http for details.
Any ideas why this started to happen, how can i fix it?
Could also be IPv6 related, if your provider/system is configured for IPv6 but has no valid IPv6 route out to the internet.
This happened to me, and doing
sysctl -w net.ipv6.conf.all.disable_ipv6=1 (as root), then trying composer again fixed the issue.
To permanently apply it, add the rule to /etc/sysctl.conf (or wherever your OS preferred is)
same problem here, since php updated to 7.2.17.
On a centos 7 with php 7.2.16 composer run just fine...
Rollback to 7.2.16 is for now the only solution found...
Edit :
Seems to be a symfony flex issue : https://github.com/symfony/flex/issues/484
I had the same problem. After days of searching, I found a solution. It seems a PHP problem. Try to comment a line of curl extension on php.ini. I am using php version 5.6.
extension=php_curl.dll
Type ; before the extension name, at least it will be like this:
;extension=php_curl.dll
I had the same issue try to install symfony twig bundle. I ran :
set http_proxy=
set https_proxy=
composer require symfony/twig-bundle
and it worked
I ran a composer global require laravel/installer simply upgrading laravel/installer according to Laravel https://laravel.com/docs/9.x/installation#the-laravel-installer and the error was resolved.
Simply Just check out your internet and it well be ok
in the XAMP i have done follwing changes
comment the follwing line
;extension=php_curl.dll
and it worked properly
My solution: connect to a vpn before running the command!
For me basically the problem was because my IP was from Iran. Connected to a vpn and it worked perfectly.
it will works when we run this command in console
composer config disable-tls true
I bypassed the problem by redirecting the output to /dev/null.
composer require symfony/orm-pack > /dev/null

Laravel error - Class setEventDispatcher does not exist

Short version
I'm getting this error, when I run php artisan serve and visit my home page:
ReflectionException (-1)
Class setEventDispatcher does not exist
Details
Laravel version: 5.6.39
Environment: local
OS: macOS Mojave 10.14.2
It started, when I got an error using npm (in another project), so I reinstalled Node (this way).
After doing that, then this project (in question) couldn't be started. I was getting this error, when running php artisan serve:
dyld: Library not loaded: /usr/local/lib/libpng16.16.dylib with anything php related
Referenced from: /usr/local/bin/php
Reason: image not found
That error was resolved by updating and upgrading brew.
Then I was capable of starting the project (php artisan serve). But when I visit the home page, this error was shown:
ReflectionException (-1)
Class setEventDispatcher does not exist
If I follow the stack trace, then I can see that it was this line (from my homeController) that triggered the error:
if( ! Auth::check() ){
return view( 'pages.home' );
}
If I commented that out, then the same error occured from another place, where the Auth-module was being used.
Here's the stack trace:
Does anyone know how to resolve this? I can't find any promising results on Google, - and I have no idea why this happens... :-/
Addition1
I tried composer clear-cache and deleting the vendor-folder, and then doing a composer install and the problem still occured.
I also checked my Service Providers, as Marcus suggested, - but I don't really know what to look for in there. It all looks pretty regular (no fancy if-statements or anything).
Addition2
I realized, that I couldn't connect to my database using Sequel Pro. And it was because Brew had updated my MySQL-version from 5.5 to 8.0.
That was resolved by doing something along these lines (I did a bunch of stuff, so I might be missing a coulple of steps):
brew unlink mysql
brew install mysql#5.7
brew switch mysql 5.7.21
brew link mysql
and I could then verify the version with mysql --version. I also had some permission issues with that MySQL-version-change, but I'm emitting that, so this doesn't get too long.
Addition3
I tried disabling the Laravel Debugbar (by deleting it from composer.json, deleting composer.lock and vendor and then running composer install). And that fixed it!! ... But!
When I later tried to install Barryvdh's IDE Helper, then the exact same error came back!?
I performed these three steps, to install the IDE Helper (and re-introduce the error):
Run this command from the root of my directory: curl https://gist.githubusercontent.com/barryvdh/5227822/raw/4be028a27c4ec782965bb8f2fdcb4c08c71a441d/_ide_helper.php -o _ide_helper.php
Add these lines to app/Provider/AppServiceProvider.php:
...
if ($this->app->environment() !== 'production') {
$this->app->register(\Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class);
}
Run this command: composer require --dev barryvdh/laravel-ide-helper
So I'm back at this error:
ReflectionException (-1)
Class setEventDispatcher does not exist
... The stack trace is identical to the one shown previously (sprung from Container.php).
Tried every solution, none of them worked.
Finally, i realised that when trying to upgrade php to 7.3.3 it was infact a network error that caused the fail. Read the logs, tried again, restarted valet and tried again.
It works now.
Upgrading to 7.3.3 was the solution indeed.
Thank you!
So this is what usually fixes it for me
Reinstall composer dependencies by removing vendor folder and composer.lock. Then run composer clear-cache and then composer install (this is usually the problem)
Check that all service providers are imported correctly in app.php under directory config
Make sure that your service providers are not importing something that does not exist, for example if you register a service provider in production but is only installed as dev:
if (env('APP_DEBUG')) {
$app->register(Barryvdh\Debugbar\LumenServiceProvider::class);
}
If you use valet, I solved it running
valet restart and all works fine.
cheers!
The fix for me was to update PHP to 7.3.3 and then restart valet. Apparently this was a bug with php 7.3
https://github.com/laravel/framework/issues/27052
Hope this helps
I got some idea... I've just run into this problem after reconfiguring my apache virtual host ports, so I restarted apache/httpd again, and the problem went away. Might it be related with the server environment?
I am facing the same issue in mac book pro. My system configuration is PHP 7.3, MySQl and I use SQL Pro. I have implemented all the above methods but nothing gets worked.
The issue is still a mystery for me but for temporary I have solved this issue using
artisan command as bellow.
php artisan serve
Its Allow me to run the project on http://localhost:8000
Hope this can help to solve this issue.
Try to restart PHP. When I reboot my Mac, then this happens. After restarting PHP everything starts to work.
sudo brew services restart nginx

php artisan optimize got stucked

after installing composer and laravel, I create new project by using commandline laravel new blog, and then I stuck at here. Please tell me what should I do? thanks.
I had the same problem. Cost me two days to figure out.
Mine is because the APCu extension. Change apc.enable_cli to 0 then it worked.
I am using php 5.5.28 and windows 10, however in windows 7 is fine with the same configuration. So check your php.ini configuration.
I had same issue, but because of xdebug running on the command line. I disabled xdebug and it resolved the issue.

Composer Download Error

i got this error when i'm trying to install composer for laravel framework :
"Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:
The openssl extension is missing, which means that secure HTTPS transfers are impossible.
If possible you should enable it or recompile php with --with-openssl"
i tried much but i don't know what should i do right now ?
i got win 8.1 , wamp 1.7 , php 5.4
open C:\wamp\bin\php\php5.4.12\php.ini & C:\wamp\bin\apache\Apache2.4.4\bin\php.ini
Find the line ;extension=php_openssl.dll and remove the semicolons ';'.
The line should look like extension=php_openssl.dll.

How to solve Laravel requires php mcrypt extension?

I searched the net, I followed the instructions to solve this problem but I could not solve it,
when I want to use Laravel php artisian it gives errors like this:
Laravel requires php Mcrypt extenstion.
Note: I am using MAMP in Mac
please give example and solution for mac with MAMP.
I had a similar issue on Ubuntu 12.04. What version of PHP are you running and does Mcrypt show up as active when you run:
<?php
phpinfo()?
?>
It's quite possible that your command-line PHP isn't the same that MAMP is using, but rather the one that came with OSX. To find out, you can open your terminal and type php -i | grep php.ini, which will show you what ini file you're using.
If this is the case, which seems likely, you can follow the steps of older SO posts such as this one to create a symlink or overwrite the default PHP.
Alternatively, you can upgrade your system's PHP using Homebrew, for instance. I'm running 5.5.8 on my Macs, and it's working great. Do note that I do not necessarily recommend this, though, as configuring MAMP to use the new version isn't a fun experience. Also note that if you do this, you'll have to install both PHP and Mcrypt through Homebrew.

Resources