Issue
After development locally and everything working, I went to push all new code which included a number of classes and models to the server. I proceeded to get an error
production.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with
message 'Class 'photo' not found' in
/var/www/vhosts/domain.com/httpdocs/bootstrap/compiled.php:6114` error.
I've tried:
composer install
composer update
composer dumpautoload -o
php artisan optimize --force
php -dmemory_limit=1G artisan optimize -f
When I run php artisan optimize --force
,
I get the following error:
PHP Fatal error: Allowed memory size of 33554432 bytes exhausted
(tried to allocate 72 bytes) in
/var/www/vhosts/domain.com/httpdocs/vendor/nikic/php-parser/lib/PHPParser/NodeAbstract.php
on line 34
after composer returns Compiling common classes
which led me to the -dmemory_limit ...
command
I've uninstalled composer, deleted the vendor directory, removed the composer cache, deleting the compiled.php file and a number of other things and still cannot get around the initial Class Photo error. Everything is working fine locally with a similar LAMP setup. I'm at a loss for ideas. Is there anything else that I can try?
Solution
I found the problem. In my eloquent relationships I had the model names in lowercase. I'm not sure why this would be a problem on one server and not the other. This was only affecting 2 new models/classes, so just an oversight on my part.
So what I had before was:
public function photos()
{
return $this->hasMany('photo')->orderBy('sort', 'ASC');
}
and I changed it to:
public function photos()
{
return $this->hasMany('Photo')->orderBy('sort', 'ASC');
}
Answered By - Chris G
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.