For 3 days I have been trying to get this to work with no luck and it's driving me absolutely insane. I have used composer to generate a skeleton cakePHP project for me and am now trying to start up the server and test everything is G2G. From my app directory I run
bin/cake server
and the following error comes up and does not deploy the app to the server.
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20160303/php_mbstring.dll' - dlopen(/usr/lib/php/extensions/no-debug-non-zts-20160303/php_mbstring.dll, 0x0009): closured error in Unknown on line 0
PHP Fatal error: You must enable the intl extension to use CakePHP.
in /Users/nateschreiner/Documents/Development/ActTwo/app/config/requirements.php on line 31
I have gone into /etc/php.ini and un-commented
extension=php_intl.dll
and I have also gone into /Applications/XAMPP/xamppfiles/etc/php.ini and un-commented the same line.
Nothing is working and it's really starting to grind my gears. Not getting any help surfing the google either.
Took me absolutly forever to solve this, however I finally did so I'll post an answer incase anyone else has this issue.
First:
brew install php#7.1
( If it's not installed already )
brew upgrade php#7.1
update symlinks:
brew link --overwrite --force php#7.1
Then:
echo 'export PATH="/usr/local/opt/php#7.1/bin:$PATH"' >> ~/.bash_profile
echo 'export PATH="/usr/local/opt/php#7.1/sbin:$PATH"' >> ~/.bash_profile
After, go to your app directory and issue command:
bin/cake server
And you should have a server started up on localhost
Related
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
I have successfully followed the Setup a Mac Dev Machine until this tutorial: https://laracasts.com/series/setup-a-mac-dev-machine-from-scratch/episodes/10?autoplay=true
The problem is that when I go to SITENAME.dev, nothing shows up. Instead, I get the following message:
This site can’t be reached
test2.dev refused to connect. Did you mean http://test2.de/? Search Google for test2 dev ERR_CONNECTION_REFUSED
I've tried this both for a laravel install (using the laravel installer) and a wordpress install. Neither one works.
Any idea why it is not working. I have followed the course step-by-step as well as the comments. For instance, I modified the .zshrc file as follows based on the course and comments:
export PATH=$HOME/bin:/usr/local/bin:$HOME/.composer/vendor/bin:$PATH
And, in case it is relevant, I am on Mac Sierra (freshly updated).
In short, where Jeffrey is able to get a home page of laravel, I get an error.
Any idea how to fix this?
Thanks.
Go to your site folder and execute the following commands:
cd your_project
composer global update
valet uninstall
rm -rf ~/.valet
rm -rf ~/.config/valet
valet install
valet link
valet open
It fixed this issue for me, and particularly after PHP upgrades.
Mac os mojave - version 10.14,
cd in your-project-folder-name and run
valet secure your-project-folder-name
Solution:
composer global update
brew upgrade nginx
cd your_project
valet start
For more details read this blog
https://medium.com/#panjeh/valet-this-site-cant-be-reached-err-connection-refused-ad424ea1e343
Have you actually started the valet service? Head over to the directory that you ran
$valet park
in, I'm assuming it's where you've also placed your project and type:
$valet start
into the terminal. That works for me.
Be sure you're over http://app.test and not https://app.test
Laravel Valet uses Not secure http as default.
By the way if you want to secure your app then use
valet secure YOURAPPNAME
Deleting the file (sudo rm /etc/resolver/dev) will clear this issue up.
IF valet is trying to open a HTTPS (SSL connection) type command line in your terminal
valet secure
I loaded up Laravel/Lumen on the new Homestead php7 box and encountered this error:
FatalThrowableError in MemcachedConnector.php line 51:
Fatal error: Class 'Memcached' not found
Doing a phpinfo(); shows there is no memcached extension, but sudo service memcached status says memcached is running. It seems there is a php7 branch for memcached here: https://github.com/php-memcached-dev/php-memcached/tree/php7
Can anyone guide me on how to get it working in the new php7 Homestead VM?
EDIT: I just saw on the homestead install documentation that it says "Memcached (PHP 5.x Only)". Question still remains on how to get it working.
The work on php-memcached for PHP7 is not yet complete, not all tests pass; You can use everything but JSON serialization, I think.
There is no pecl support for PHP7, so right now you need to install extensions manually, like this:
git clone https://github.com/php-memcached-dev/php-memcached
cd php-memcached
git checkout php7
phpize
./configure
make
sudo make install
You must make sure that phpize is the PHP7 version. Additionally, if the php in your PATH is not PHP7, then the php-config in your PATH is not either, in this case you must pass --with-php-config=/absolute/path/to/php7-config to ./configure.
I have the same problem, but on Windows when using XAMPP. It seems memcached works for now with PHP 5+ only.
The problem for Windows users is to find the right .dll file named
php_memcache.dll (x86/x64 platforms).
I've spent hours looking for a solution, but nothing found. The very fresh description how to use memcached is here:
HOW TO: Install Memcache on XAMPP (Windows 7/8/10)
We still have to wait for PHP7+ implementation.
I have installed composer in windows platform. But when am trying to install the composer.phar through this command,
php -r "readfile('https://getcomposer.org/installer');" | php
it's giving me this error-
Warning: readfile(https://getcomposer.org/installer): failed to open
stream: A connection attempt failed because the connected par ty did
not properly respond after a period of time, or established connection
failed because connected host has failed to respond. in Command line
code on line 1.
The internet configuration is OK. Please help. Am going through a hell of time...installing Laravel .
Had also some problem with the installation.
At the end I used the installer:
https://getcomposer.org/Composer-Setup.exe
Installing with installer
That line just pulls and outputs a file that contains a PHP script that will actually install Composer, thats why it is piped to PHP in the end of the line.
If readfile doesn't work, you can simply download the file with your browser by saving the file from https://getcomposer.org/installer then execute it from the folder where you downloaded:
cat ~/installer | php
Assuming that you downloaded it to your home ~ folder with the name installer.
Manual installation
It also worth mentioning that this installer just makes a few checks after it copies the actual composer.phar file, that you can download by yourself from the bottom of the download page, with the link named: Latest Snapshot
Thats all. By downloading that file you technically "installed" Composer. Just go to the folder where you downloaded it and you can start to use it:
php composer.phar
I the solution above didn't work for me. So I found another way for time being to make things moving. So, I used Larapack. I know that's like running away from problems but it worth it for now. As I move on, I will find a way round.
Thanks a lot guys for your help.
I am new in Ubuntu and try to migrate a laravel app to ubuntu.
Please take a look at below steps done.
1.Copied my laravel project and upload database.
2.Started my Xampp server and pointed my laravel app in browser, it showing error like.
Warning: require(/opt/lampp/htdocs/timegear/bootstrap/../vendor/autoload.php): failed to open stream: Permission denied in /opt/lampp/htdocs/timegear/bootstrap/autoload.php on line 17
Fatal error: require(): Failed opening required '/opt/lampp/htdocs/timegear/bootstrap/../vendor/autoload.php' (include_path='.:/opt/lampp/lib/php') in /opt/lampp/htdocs/timegear/bootstrap/autoload.php on line 17
When trying to update the composer with terminal throwing error like Mcrypt extension is required.
Please give me a solution for it.
Thanks and Regards.
You are missing the Mcrypt extension, to install:
sudo apt-get install php5-mcrypt
Then:
sudo updatedb && locate mcrypt.ini
Should show it located at /etc/php5/mods-available
locate mcrypt.so
Then edit mcrypt.ini with
chang thextension=mcrypt.so to extension=/usr/lib/php5/20121212/mcrypt.so (or whatever is the location of your mcrypt.so.
Next, create the symbol links
ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/cli/conf.d/20-mcrypt.ini
ln -s /etc/php5/mods-available/mcrypt.ini /etc/php5/apache2/conf.d/20-mcrypt.ini
and finally, restart apache
service apache2 restart
Hope this helps.
Install the mcrypt PHP extension.