PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, January 24, 2022

[FIXED] Laravel/Composer not compliling all classes to compiled.php

 January 24, 2022     composer-php, laravel, laravel-4, php     No comments   

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
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing