Laravel / Envoyer production error - Class view does not exist - php

I recently created a new production deployment for a new Laravel-based system. Initially, I had a few permissions issues with the storage folder that I resolved pretty easily. Once I resolved those, I had the app running correctly, but upon my next deployment (with Envoyer), I ran into a different issue that I haven't been able to pin down.
I'm now getting a fatal PHP error that I wasn't getting before:
PHP Fatal error: Uncaught ReflectionException: Class view does not
exist in
/var/www/Core/releases/20170804125010/vendor/laravel/framework/src/Illuminate/Container/Container.php:719\nStack
trace:\n#0
/var/www/Core/releases/20170804125010/vendor/laravel/framework/src/Illuminate/Container/Container.php(719):
ReflectionClass->__construct('view')\n#1
/var/www/Core/releases/20170804125010/vendor/laravel/framework/src/Illuminate/Container/Container.php(598):
Illuminate\Container\Container->build('view')\n#2
/var/www/Core/releases/20170804125010/vendor/laravel/framework/src/Illuminate/Container/Container.php(567):
Illuminate\Container\Container->resolve('view')\n#3
/var/www/Core/releases/20170804125010/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(708):
Illuminate\Container\Container->make('view')\n#4
/var/www/Core/releases/20170804125010/vendor/laravel/framework/src/Illuminate/Container/Container.php(1139):
Illuminate\Foundation\Application->make('view')\n#5
/var/www/Core/releases/20170804125010/vendor/laravel/framewo in
/var/www/Core/releases/20170804125010/vendor/laravel/framework/src/Illuminate/Container/Container.php
on line 719
I've played around with various permissions, tried manually running composer install/update, npm install/etc. with no resolution. Any thoughts would be greatly appreciated.

After quite a bit of experimentation with no luck, I think I resolved it. The Ubuntu user that was set up for deployment with Envoyer was, by default, deploying everything with the 'envoyer' group permissions. This created a permissions conflict with the actual app permissions on Ubuntu. I updated the default group for the deploying user to 'www-data' and it seems that everything is cleared up now.

Related

Logger does not work anymore after upgrade from Laravel 5.5

Since I've upgraded to Laravel version 5.6 from Laravel version 5.5 my Logger doesn't work properly anymore.
At first I got the following error stack :
laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): Log [] is not defined. at /home/vagrant/Code/grotesmurf/vendor/laravel/framework/src/Illuminate/Log/LogManager.php:181)
which was solved by simply adding the new config/logging.php file that is provided by Laravel 5.6.
But now I'm getting no output from the Logger! I'm simply running \Log::info('hello!') as a tinker command, but it doesn't generate any log output anymore (same for scripts calling the \Log() method).
I've tried different LOG_CHANNEL settings (daily, single, stack), but none of these work.
Hope anyone has ran into this error already and is able to provide me with some suggestions. I have followed the upgrade guide and it doesn't help unfortunately.
Thanks in advance.
P.S. I'm running php version 7.1 & am on ubuntu.
P.P.S. I have cleared all cached config using artisan.
Well I have found the actual problem, we use an adjusted storage_path() method in our application and the new Logger is now using the storage_path() method to generate its path - this caused the log file to be created in a different directory than storage/logs.
i had the same issue, deleting the files in bootstrap/cache solved it.

Symfony project unable to load in localhost

I am new in symfony framework. Getting the below error when download the full project in localhost but it works in server.
Fatal error: Class 'Symfony\Bridge\Doctrine\ManagerRegistry' not found
in D:\wamp\www\DOFE\edin\vendor\doctrine\doctrine-bundle\Registry.php
on line 28
Thanks in advance.
You probably want to execute composer dump-autoload to force composer to regenerate the autoload namespaces for your app.
Regarding your comment, if you are getting this message it means you are in prod and you should switch to the dev environment to have details about the error (access to the symfony profiler).
Just add app_dev.php after the host in the url.

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.

L5.2 PHP Fatal error: Declaration of Illuminate\Auth\SessionGuard::basic

I just pushed my L5.2 app to production server. I have made a few changes, but suddenly I get the following error:
PHP Fatal error: Declaration of Illuminate\Auth\SessionGuard::basic($field = 'email')
must be compatible with
Illuminate\Contracts\Auth\SupportsBasicAuth::basic($field = 'email', $extraConditions
= Array) in /home/forge/domain.com/bootstrap/cache/compiled.php on line 461
The app works fine locally and on the staging server.
just remove the bootstrap/cache/compiled.php file
rm bootstrap/cache/compiled.php
then run
composer dump-autoload
and
php artisan clear-compiled
it should work
I solved it.
I had to do:
rm bootstrap/compiled.php
I suppose that you have run composer update on production. You should copy composer.lock to production server (if you haven't done it yet) and run composer install to install exact same version you have on your localhost
You should also run php artisan clear-compiled because it might be also the problem.
Yes as other said, removing that file solves the error.
But in my case that file gets generated again and again automatically after 1 mins. (So to keep site running I need to manually delete that file over and over :) )
So here is what I did:
Opened that bootstrap/compiled.php, removed all the content and revoke write permission for that file.
And that worked very well for me.
I know its worst/temporary solution, but unless we know the exact cause of that issue and better solution, we can use this solution.
However I don't recommend anyone to use this solution for production sites, but you can use it for just a demo site like my case.

CakePHP 3.0 not running on other machines

I've developed a small project on a machine, using CakePHP 3.0, and I need it to run on another machine. I've tried to install it on several other machines.
If I run the composer to install the CakePHP 3.0, then I copy my stuff to overwrite it, the project works. I've tried this on two machines and had no problem so far. If I don't run the composer, and just copy the stuff to the target machine, it gives me the following error. I've tried this on 3 machines, and every machine gives me this:
Fatal error: Class 'Locale' not found in /home/u113681897/public_html/vendor/cakephp/cakephp/src/I18n/I18n.php on line 229
Fatal error: Class 'Locale' not found in /home/u113681897/public_html/vendor/cakephp/cakephp/src/I18n/I18n.php on line 229
I've copied the whole project to this server to test.
I told you this because I thought it has something to do with my problem. The point is that I have to run this on a machine that is not mine, and I can't install composer on it. The /public_html/vendor/cakephp/cakephp/src/I18n/ has files related to internationalization and localization, but my project will never be translated, so a workaround to make the project ignore those files would be enough to solve my problem.
The following code is an excerpt from the (...)/I18n/I18n.php that might be relevant:
<?php
namespace Cake\I18n;
use Aura\Intl\FormatterLocator;
use Aura\Intl\PackageLocator;
use Aura\Intl\TranslatorFactory;
use Cake\I18n\Formatter\IcuFormatter;
use Cake\I18n\Formatter\SprintfFormatter;
use Locale;
class I18n {
// lots of code here
public static function defaultLocale() {
if (static::$_defaultLocale === null) {
static::$_defaultLocale = Locale::getDefault() ?: 'en_US';
// the line above is the Line 229
}
return static::$_defaultLocale;
}
// many code here too
}
I've checked that another file also tries to access this Locale class, but I don't know if there are other files trying to access it as well. Many files from everywhere inside the project tries to access methods from I18n.php. I need it running but I can't figure out how to make it run.
Any help will be greatly appreciated.
As I just found out, prior to CakePHP 3.0, the installation must be done by composer, as stated in the 3.0 migration guide:
CakePHP should be installed with Composer
Since CakePHP can no longer easily be installed via PEAR, or in a shared
directory, those options are no longer supported. Instead you should use
Composer to install CakePHP into your application.
So it won't run on regular free web hosting services.

Categories