I have a Symfony2 project that uses quite a few 3rd Party bundles. I use Sonata Admin Bundle for the application admin. I am almost finished with my project development and I'm trying to get it live on Amazon EC2. I am using GIT to deploy my application, I have managed to get everything setup but I am coming across a very weird problem. The project is running just fine on the local server but when I get it live I get the error:
InvalidArgumentException: Unable to load class "Sonata\AdminBundle\Admin\Admin"
While trying to run app/console commands I get the Error:
PHP Fatal error: Class 'Sonata\BlockBundle\SonataBlockBundle' not found in /var/www/html/candulifestyle.com/app/AppKernel.php on line 25
Fatal error: Class 'Sonata\BlockBundle\SonataBlockBundle' not found in /var/www/html/candulifestyle.com/app/AppKernel.php on line 25
I'm having a real hard time tracing the problem here. The project is running perfectly on my local system. Has anyone come across a problem like this. Please let me know if anyone has any insight on such a problem.
I had the same very strange problem (PHP Fatal error: Class 'Sonata\BlockBundle\SonataBlockBundle' not found although it was present in the right folder) on a DigitalOcean server (running Ubuntu 12.04), whereas I didn't have the problem on my Ubuntu 12.04 VM instance.
I finally found the solution to the problem.
I just had to update Composer as I should have already done before:
composer self-update
And then run again this:
composer install
And everything was fine again.
Related
Whenever I try to run any command related to php artisan or composer this error shows up:
PHP Fatal error: Interface 'Monolog\ResettableInterface' not found in path\to\project\root\vendor\monolog\monolog\src\Monolog\Logger.php on line 28
I open the file, and it points me to :
class Logger implements LoggerInterface, ResettableInterface
I try to find the Logger interface and it's there.
I really can't find any other solutions and the ones recommended here by SO are outdated.
I use laravel 5.7 running composer version 1.8.0 on a xampp server with PHP 7.2.10 on Windows 10
Please feel free to ask more questions and I'll try to answer them without ruining my NDA.
Update: it works now thanks to that one person who answered.
If anyone needs this solution, you can do what Saumini Navaratnam suggested; removing the vendor folder and running composer update on the root folder. I, myself found another solution that might work and it is: running composer update --no-dev as the ResettableInterface came from a dev dependency. Weird, but it works fine now.
Again this works only on Laravel 5.7, at least for now.
I am trying to get the psycopg2 module for python running in my Laravel application. It is working online on Heroku (I installed it there), but I am wondering about how I can get it running locally.
In Laravel I use:
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
Locally it throws this Error:
import psycopg2
ImportError: No module named psycopg2
On heroku, the code works properly, so it is just about the environment.
Does anyone know how to fix that?
PS: I use XAMPP locally
Thank you for your attention!
I'm running debian jessie and managed to get python 2.7 installed twice. When I specify the directory (/usr/bin/python or /usr/local/bin/python) I can make the "No module" error appear and disappear. Since I haven't seen this explanation before, I thought I'd share my experience. Seems strange that ALL the attempts at installation acted on the version in /usr/local/bin, while the PATH selects the version at /usr/bin. I think I will try removing the one at /usr/bin. Hope this helps someone.
I have just installed a laravel app on the "to-be" production server (1and1 shared linux server).
With the same codebase as on my development server (Ubuntu 14.04 lts) my custom artisan commands are not available (php5.5 artisan list) on the production server.
I have done composer dump-autoload already.
I have also checked the app/start/artisan.php file and that is OK and is executed.
I have checked the app/config/production/app.php for the service providers and they seem to be all right.
I have also spent the better part of the day here on stackoverflow to find a solution, but without much success.
My Laravel version is: 4.1.28
Thanks so much for any help.
If you are getting no errors, you probably don't have the same codebase in production because, if resolve commands in your artisan.php file:
Artisan::resolve('CommandName');
And Laravel doesn't have access to this class, it will raise an exception:
"ReflectionException","message":"Class CommandName does not exist"
Im trying to deploy laravel 4 on a shared host. When I do so and trying to run the site I get an error saying :
Class 'Illuminate\Database\DatabaseServiceProvider' not found
I guess this has something to do with composer, I have read a lot and some say that I should run 'composer dump-auto' on the server, I can't do that because I have no shell-access.
Other say I should run composer update locally and then upload it and it should all be fine. That does not work either.
Any ideas how I should approach this?
I have a simple PHP app that I developed locally in MAMP. I did use a few Composer packages. It works perfectly on my local machine. When I deploy the website using Beanstalk App (not AWS Beanstalk, I'm referring to Beanstalk the Git hosting and deployment service) it throws an error once the first class name is referenced in the code.
Fatal error: Class 'User' not found in /srv/www/example.com/public_html/utilities/authenticate.php on line 8
This class is specific to an ActiveRecord Model class for accessing the database. In the code it looks like this:
$user_row = User::find_by_email($theuser);
Very simple and works in my local development environment. ActiveRecord is autoloaded by Composer.
I then tried deploying the app via sftp to my Centos VPS and to my surprise the error went away and the app works as expected. My best guess was that Beanstalk was somehow corrupting the app during deployment. So to test that theory, I setup a bare Git repo on the server and used a post-receive hook to checkout the repo into the public Apache folder. This resulted in the same error I experienced with Beanstalk. It seems the problem is associated with git deployment. I checked that the files had the standard 644 permissions and that folders are set to 755. Apache owns the public folder so ownership isn't the problem either. I'm truly at a loss for why this is occurring. Any wisdom on the matter is greatly appreciated.
Try to check your .gitignore file. Even better if you paste it's content here. Are you sure you don't need to run composer install on the server after deployment?
I've managed to fix the issue. It was a misconfiguration of ActiveRecord on my part. My "User" model class resided in a file named "user.php." That is an incorrect naming convention when using ActiveRecord. Since the class name begins with an uppercase letter so too must the file name. By renaming the file to "User.php" ActiveRecord was able to locate the class correctly. The odd part is that the incorrect naming was not a problem when the documents were placed on the server via sftp. I must assume that there are complexities to the CentOS file system that I don't fully understand. I am aware that unlike CentOS, OS X doesn't have a case sensitive file system and that is the reason why this error never occurred in development.