Laravel Error On Server for mailer - php

I have tried setting up this project in two different environments and keep getting the same error regardless of PHP version
PHP Fatal error: Uncaught exception 'ReflectionException' with message 'Class mailer does not exist' in /var/www/sos/laravel/vendor/laravel/framework/src/Illuminate/Mail/vendor/illuminate/container/Container.php:779\nStack trace:\n#0 /var/www/sos/laravel/vendor/laravel/framework/src/Illuminate/Mail/vendor/illuminate/container/Container.php(779): ReflectionClass->__construct('mailer')\n#1 /var/www/sos/laravel/vendor/laravel/framework/src/Illuminate/Mail/vendor/illuminate/container/Container.php(659): Illuminate\\Container\\Container->build('mailer', Array)\n#2 /var/www/sos/laravel/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(644): Illuminate\\Container\\Container->make('mailer', Array)\n#3 /var/www/sos/laravel/vendor/laravel/framework/src/Illuminate/Mail/vendor/illuminate/container/Container.php(890): Illuminate\\Foundation\\Application->make('Illuminate\\\\Cont...')\n#4 /var/www/sos/laravel/vendor/laravel/framework/src/Illuminate/Mail/vendor/illuminate/container/Container.php(851): Illuminate\\Container\\Container->reso in /var/www/sos/laravel/vendor/laravel/framework/src/Illuminate/Mail/vendor/illuminate/container/Container.php on line 779
After about 5-6 hours of testing i cannot get this error to go away.

Make sure that there is no mail notification service is activated (Mail Service)
See:
https://laravel.com/docs/5.3/mail
Make sure that composer require guzzlehttp/guzzle dependency.
After making sure this dependency. After this dependency
Check your .env file for mail configuration
check your config/mail.php
and finally check App\Mail\Myfiles.php
files to make sure of the configuration that your web app support.

Check you app.php file for mail service provider Illuminate\Mail\MailServiceProvider::class, line if not exist then place it and update composer after clear artisan cache.
UPDATE
If above detail will not work for you, you need to check your .env file for unwanted space. Some time this error was thrown because one of the values in this file had space. Remove that space and check.

Related

"Your configuration files are not serializable" error message after adding GELF logger in Laravel 5.6

After adding GELF logging according to this how to https://medium.com/#vaidaslungis/setup-graylog-in-laravel-5-6-logging-d2276bcb9cfa
the php artisan config:cache command isn't working anymore.
The error message is:
In ConfigCacheCommand.php line 68:
Your configuration files are not serializable.
In config.php line 382:
Call to undefined method Gelf\Publisher::__set_state()
Is it still possible to cache the config? If so, what needs to be changed?
In case an error occurs while logging, the exception is stored in a class variable of the IgnoreErrorTransportWrapper ($lastError). The exception is not serializable, therefore the serialization of the logger fails.

Symfony 3 deploying app via ftp error

I need to upload my symfony 3 project online, but I have only access to ftp. So I did all necessary steps I found:
composer update
Clear the cache for production: php app/console cache:clear --env=prod
Upload all app folder on server
After I open my website I got the following error:
Fatal error: require(): Failed opening required
'/nfsmnt/hosting2_1/a/8/a87b3594-7cfe-459e-ad62-286d2dba2c54/zorbfutbal.sk/web/var..\vendor\symfony\symfony\src\Symfony\Component\ClassLoader\ApcClassLoader.php'
(include_path='.:/usr/php56/lib/php') in
/nfsmnt/hosting2_1/a/8/a87b3594-7cfe-459e-ad62-286d2dba2c54/zorbfutbal.sk/web/var/bootstrap.php.cache on line 1780
I checked the file and I have it there and also set all permissions.
What is confusing me is that path from error before my actual domain name.
"/nfsmnt/hosting2_1/a/8/a87b3594-7cfe-459e-ad62-286d2dba2c54/"
I dont know where it comed from and how to fix it.
Any idea? Thanks
You are absolutely sure you set the file permissions correctly like indicated here:
http://symfony.com/doc/current/setup/file_permissions.html#using-acl-on-a-system-that-supports-setfacl-linux-bsd
The message you posted seems to point to something like that.
Also run:
php bin/symfony_requirements
just to check that you've met all the other requirements.

installing Google Client Library for Google Analtics PHP

first of all I am new to this topic, so I hope my question is not too stupid.
I want my website to have PHP access to Google Analytics metrics. I followed every step of this description from google. Unfortunately when I upload everything on my server and try to run the test-site, I always get the following error-message:
Fatal error: Uncaught exception 'Exception' with message 'This library
must be installed via composer or by downloading the full package. See
the instructions at
https://github.com/google/google-api-php-client#installation.' in
/home/users/myftp/dev.mywebsite.com/dashboard/google-api-php-client-master/src/Google/autoload.php:14
Stack trace: #0
/home/users/myftp/dev.mywebsite.com/dashboard/HelloAnalytics.php(8):
require_once() #1
/home/users/myftp/dev.mywebsite.com/dashboard/HelloAnalytics.php(104):
getService() #2 {main} thrown in
/home/users/myftp/dev.mywebsite.com/dashboard/google-api-php-client-master/src/Google/autoload.php
on line 14
So apparently there is something wrong with the embedding of the Google client library. In the error message it says I have to use Composer, but in the GitHub documentation they say, manual download would be fine as well. I think in the end this shouldn't make any difference? I am not familiar with composer or GitHub, this is why i downloaded it manually.
I uploaded it on the server and put it into the same directory like the HelloAnalytics.php. I address it in HelloAnalytics.php via
require_once 'google-api-php-client-master/src/Google/autoload.php'
From the looks of it you are using the wrong autoloader.
src/Google/autoload.php looks for the composer autoloader and if it doesn't exist it throws the exception you are getting. Since you didn't install using Composer it is not found and that exception is thrown.
If you clone the repository using git you will have the correct SPL autoloader. If you download the package it uses the composer autoloader.
Try downloading using:
git clone -b v1-master https://github.com/google/google-api-php-client.git
Or switch to the v1-master branch and use this autoloader instead. You will see that file differs between the master branch and the v1-master branch.
to avoid AUTOLOADer error, install MASTER-V1 version:
https://github.com/google/google-api-php-client/tree/v1-master
p.s. if you will get other error, then ensure that you have correctly included the "SERVICE EMAIL" (that is like: xxxxxx#analytics-xxxxx.iam.gserviceaccount.com ).

Symfony2 - Class XXX not found

I have deployed a Symfony Application to a one.com server. I wrote a Mail service that sends my emails via SwiftMailer.
Now, since one.com has no phar-extensions allowed, composer cannot be updated via ssh. So I generated the classmap locally with
composer update -o
Whenever I try to get the Mail service, the application throws an error:
Fatal error: Class
'Stocksolutions\ShopBundle\DependencyInjection\Mail' not found in
/customers/4/b/b/stocksolutions.be/httpd.www/releases/20150204201140/app/cache/dev/appDevDebugProjectContainer.php
on line 3602
I have searched the composer classmap and the class that isn't found is inside it:
'StockSolutions\\ShopBundle\\DependencyInjection\\Mail' => $baseDir . '/src/StockSolutions/ShopBundle/DependencyInjection/Mail.php'
Furthermore, I can get other services in the container, f.e. those from the FOSUserBundle, but getting my custom services throws an error. Also, I don't get these errors when testing locally..
Any ideas?
It's case-sensitive problem.
Your error:
Fatal error: Class
'Stocksolutions\ShopBundle\DependencyInjection\Mail' not found
Small letter s in Stocksolutions namespace for PSR forces to search for the file /src/Stock**s**olutions/ShopBundle/DependencyInjection/Mail.php, but exist /src/Stock**S**olutions/ShopBundle/DependencyInjection/Mail.php.
On local system likely Windows, where the path/filenames case-insensitive, error does not occur.
P.S. Most likely a typo in class namespace is in the bundle service description (services.yml/services.xml).

Symfony 2.4 You have requested a non-existent service "payment.encryption_service"

I'm migrating a symfony project from 2.0 to 2.4 version.
I've correctly configured all the parameters and services.
But the problem occured with JMS vendor, this is the error shown:
Fatal error: Uncaught exception
'Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException'
with message 'You have requested a non-existent service
"payment.encryption_service".' in
C:\wamp\www\symfony\app\bootstrap.php.cache on line 2027
This message is blocking me, do you have any issue, any idea?
I had the same problem. I don't know exactly what happened, but my problems went away after I manually cleared the cache using
rm -rf app/cache/prod/*
Considering your settings are on Windows, try manually deleting entries at app\cache\prod using Windows Explorer. I couldn't use app/console cache:clear --env=prod since the console would crash after showing that error message.
Another correct answer could be checking every service.yml in yml parser, for example http://yaml-online-parser.appspot.com
You have requested a non-existent service
could mean, that symfony can't parse correctly .yml files.
This means your the mentioned parameter is missing from your app/config/parameters.yml or other alike file that you are using to store your parameters. Set this parameter to a value and it should work.
E.G. I had the same error being "You have requested a non-existent parameter "domain".
I then added following line to the parameters.yml file:
domain: example.com
That did the trick.

Categories