laravel not class found in deployment server - php

I have a Laravel 4 application working fine on my local machine. I've cloned it onto my VPS. When I run composer install or composer update, I get errors that "class not found". I've checked vendor/composer/autoload_classmap.php and my classes are there. The class is located in the standard app/models/. I removed some code, which finally allowed the composer to update. However none of my custom classes all located inside app/models are being loaded. Any ideas what's going on? Thanks.
Local: php version 5.5.10
VPS: php version 5.5.9
Edit: Included error log
[2014-10-23 02:50:37] production.ERROR: exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'Role' not found' in ../app/routes.php:214
Stack trace:
#0 [internal function]: Illuminate\Exception\Handler->handleShutdown()
#1 {main} [] []
Role.php is located in app/models/
Edit2: Added route
Route::group(array('before' => 'auth.admin'), function() {
$roles = new Role();
Route::get('/help', array(
'as' => 'help',
'uses' => 'HelpController#getHelp'
));
}
This isn't the full route, but that's essential it. Everything works fine on local machine also.

I found the problem with the help of others. MY VPS did not support short tags. My Role.php began with <?. I corrected it with <?php and everything works.

Related

PHP fatal error uncaught exception after installing magento2

I have installed magento2 in my linux centos7. After installing magento2 successfully while accessing the web page is getting following error with empty content.
{{menuState.title}}
PHP version:7.1.3
OS: centos7
And the PHP-fpm error log has following error.
PHP Fatal error: Uncaught TypeError: Argument 1 passed to Zend_Controller_Plugin_Abstract::setResponse() must be an instance of Zend_Controller_Response_Abstract, instance of Magento\Framework\HTTP\PhpEnvironment\Response given, called in /var/www/magento2/lib/internal/Magento/Framework/Profiler/Driver/Standard/Output/Firebug.php on line 61 and defined in /var/www/magento2/vendor/magento/zendframework1/library/Zend/Controller/Plugin/Abstract.php:70
Stack trace:
#0 /var/www/magento2/lib/internal/Magento/Framework/Profiler/Driver/Standard/Output/Firebug.php(61): Zend_Controller_Plugin_Abstract->setResponse(Object(Magento\Framework\HTTP\PhpEnvironment\Response))
#1 /var/www/magento2/lib/internal/Magento/Framework/Profiler/Driver/Standard.php(195): Magento\Framework\Profiler\Driver\Standard\Output\Firebug->display(Object(Magento\Framework\Profiler\Driver\Standard\Stat))
#2 [internal function]: Magento\Framework\Profiler\Driver\Standard->display()
#3 {main}
thrown in /var/www/magento2/vendor/magento/zendframework1/library/Zend/Controller/Plugin/Abstract.php on line 70
How can I resolve this error?
This was a Magento Bug reported ...
But it's already been ...
https://github.com/magento/magento2/issues/7068
So, come on ...
Did you update the magento? What is the current version?
I found this information at the base of Magento: https://devdocs.magento.com/guides/v2.3/config-guide/bootstrap/mage-profiler.html
You have this option ...
The temporary fix is install symfony / yaml from dev branch and then our module:
              composer require symfony/yaml: dev-issue-814
    
          composer require mirasvit/module-profiler
Try using / installing php7.2
See this Magento Project reference >>>
https://magento.stackexchange.com/questions/49000/magento-2-is-there-a-profiler
Be sure to back up before the above procedures ...
Since I don't know the correct version of your current Magento, I looked for alternatives to fix.
I hope it helps you ...
Good luck! Send news about your progress ...

Laravel Cannot declare class Symfony\Component\HttpFoundation\AcceptHeader, because the name is already in use

I just took a project from a couple of months ago which was made in Laravel. This project also utilizes Laravel Voyager - the admin panel package.
After browsing to http://example.com/admin, I got this weird error which came out of nowhere and I'm also unsure how to debug it. It looks like this:
Fatal error: Cannot declare class Symfony\Component\HttpFoundation\AcceptHeader, because the name is already in use in /c/Users/User/Code/example-website/vendor/symfony/http-foundation/AcceptHeader.php on line 22
Fatal error: Uncaught Error: Class 'Symfony\Component\HttpFoundation\AcceptHeaderItem' not found in /c/Users/User/Code/example-website/vendor/symfony/http-foundation/AcceptHeader.php:61 Stack trace: #0 [internal function]: Symfony\Component\HttpFoundation\AcceptHeader::Symfony\Component\HttpFoundation\{closure}(Array) #1 /c/Users/User/Code/example-website/vendor/symfony/http-foundation/AcceptHeader.php(57): array_map(Object(Closure), Array) #2 /c/Users/User/Code/example-website/vendor/symfony/http-foundation/Request.php(1664): Symfony\Component\HttpFoundation\AcceptHeader::fromString('text/html,appli...') #3 /c/Users/User/Code/example-website/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php(54): Symfony\Component\HttpFoundation\Request->getAcceptableContentTypes() #4 /c/Users/User/Code/example-website/vendor/laravel/framework/src/Illuminate/Http/Concerns/InteractsWithContentTypes.php(44): Illuminate\Http\Request->wantsJson() #5 /c/Users/User/Code/example-website/vendor/laravel/framework/src/Illumina in /c/Users/User/Code/example-website/vendor/symfony/http-foundation/AcceptHeader.php on line 61
This error is very expected and I've never seen it before in my project (or anywhere else for that matter).
How can I debug this issue?
As a sanity check, delete the vendor directory and then run composer install to re-fetch your dependencies and see if the error is resolved. If not, then attempt composer update to fetch the latest versions of your dependencies in which this issue may have been resolved.

Error clearing cache / composer install - SensioFrameworkExtraBundle not found in kernel.php line 33

I face an issue since last Friday. Everything was working fine on my project and then friday when deploying:
after
$> php bin/console cache:clear
My Symfony project doesn't work anymore. I got this error:
Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "SensioFrameworkExtraBundle" from namespace "Sensio\Bundle\FrameworkExtraBundle".
Did you forget a "use" statement for another namespace? in /Users/dam/Development/Alara/rayflex/git/rayborn/src/Kernel.php:33
Stack trace:
#0 /Users/dam/Development/Alara/rayflex/git/rayborn/vendor/symfony/http-kernel/Kernel.php(492): App\Kernel->registerBundles()
#1 /Users/dam/Development/Alara/rayflex/git/rayborn/vendor/symfony/http-kernel/Kernel.php(132): Symfony\Component\HttpKernel\Kernel->initializeBundles()
#2 /Users/dam/Development/Alara/rayflex/git/rayborn/vendor/symfony/framework-bundle/Console/Application.php(64): Symfony\Component\HttpKernel\Kernel->boot()
#3 /Users/dam/Development/Alara/rayflex/git/rayborn/vendor/symfony/console/Application.php(148): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /Users/dam/ in /Users/dam/Development/Alara/rayflex/git/rayborn/src/Kernel.php on line 33
I tried to delete my vendor and reinstall same error
I tried a composer selfupdate && composer update
I Also tried to put the use in kernel.php...
Still nothing
I took an old tag of my project who was working fine Some month back. Same error..
I have Fix my problem on reinstalling SenSio Bundle
$ composer require sensio/framework-extra-bundle
I can't explain why, it was already installed and in the composer.json before ..
Thank for your help !

Laravel 5.2 artisan optimize - php_strip_whitespace failed to open stream: No child processes

Since upgrading to Laravel 5.2 from 5.1, when running artisan optimize on CircleCI, running PHP 5.6.14, I am getting
[ErrorException]
php_strip_whitespace(/var/laravel/project/root): failed to open stream: No child processes
Where /var/laravel/project/root is the directory where composer.json and vendor reside.
The command runs fine on my dev box running PHP 5.6.11-1ubuntu3.1. I followed the official 5.1 to 5.2 upgrade guide.
Exception trace:
() at /var/laravel/project/root/vendor/classpreloader/classpreloader/src/ClassPreloader.php:124
Illuminate\Foundation\Bootstrap\HandleExceptions->handleError() at n/a:n/a
php_strip_whitespace() at /var/laravel/project/root/vendor/classpreloader/classpreloader/src/ClassPreloader.php:124
ClassPreloader\ClassPreloader->getCode() at /var/laravel/project/root/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php:83
Illuminate\Foundation\Console\OptimizeCommand->compileClasses() at /var/laravel/project/root/vendor/laravel/framework/src/Illuminate/Foundation/Console/OptimizeCommand.php:64
Illuminate\Foundation\Console\OptimizeCommand->fire() at n/a:n/a
call_user_func_array() at /var/laravel/project/root/bootstrap/cache/compiled.php:1217
Illuminate\Container\Container->call() at /var/laravel/project/root/vendor/laravel/framework/src/Illuminate/Console/Command.php:169
Illuminate\Console\Command->execute() at /var/laravel/project/root/vendor/symfony/console/Command/Command.php:256
Symfony\Component\Console\Command\Command->run() at /var/laravel/project/root/vendor/laravel/framework/src/Illuminate/Console/Command.php:155
Illuminate\Console\Command->run() at /var/laravel/project/root/vendor/symfony/console/Application.php:787
Symfony\Component\Console\Application->doRunCommand() at /var/laravel/project/root/vendor/symfony/console/Application.php:186
Symfony\Component\Console\Application->doRun() at /var/laravel/project/root/vendor/symfony/console/Application.php:117
Symfony\Component\Console\Application->run() at /var/laravel/project/root/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:107
Illuminate\Foundation\Console\Kernel->handle() at /var/laravel/project/root/artisan:36
Any ideas on how I can resolve this please?
I found the answer on https://laracasts.com/discuss/channels/laravel/laravel-optimize-error where johnwheal mentions that config/compile.php is wrong.
It turns out that the files array in config/compile.php was emptied in a commit in April 2015 but I can't see the change mentioned in the Upgrade Guide. It has since been added to the Upgrade Guide.
To fix the problem either:
Empty the files array in config/compile.php
or
Remove BusServiceProvider.php and ConfigServiceProvider.php from the files array in config/compile.php
.
The reason for this error is the BusServiceProvider and ConfigServiceProvider have been removed, as part of the 5.1 to 5.2 transition. Although the answer provided to remove all compiled classes will fix the problem, the only two you need to remove is BusServiceProvider and ConfigServiceProvider from config/compile.php.
'files' => [
realpath(__DIR__.'/../app/Providers/AppServiceProvider.php'),
realpath(__DIR__.'/../app/Providers/BusServiceProvider.php'), // This one
realpath(__DIR__.'/../app/Providers/ConfigServiceProvider.php'), // And this one
realpath(__DIR__.'/../app/Providers/EventServiceProvider.php'),
realpath(__DIR__.'/../app/Providers/RouteServiceProvider.php'),
],

laravel 5 .. ubuntu .. command line

I am working using laravel5 php framework on ubuntu and I have 2 problems
1- when I try to use the composer to require anything .. it doesnt work
2- when i tried to make some changes to illuminate/Html .. it doesn't work too
so after that when i tried to use the artisan to serve my project I got that error
PHP Fatal error: Class 'Illuminate\Html\HtmlServiceProvider' not found in /home/shaimaa/Sites/Laravel5/eoswdt/storage/framework/compiled.php on line 5617
exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Class 'Illuminate\Html\HtmlServiceProvider' not found' in /home/shaimaa/Sites/Laravel5/eoswdt/storage/framework/compiled.php:5617
Stack trace:
#0 /home/shaimaa/Sites/Laravel5/eoswdt/storage/framework/compiled.php(1500): Illuminate\Foundation\Bootstrap\HandleExceptions->fatalExceptionFromError(Array)
#1 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()
#2 {main}
Just run the following in your composer
composer require "illuminate/html":"5.0.*"
Inside your config/app.php add the following codes inside it
In the 'providers' => [ ..]
'Illuminate\Html\HtmlServiceProvider',
And in the
'aliases' => [ ..]
'Form'=> 'Illuminate\Html\FormFacade',
'HTML'=> 'Illuminate\Html\HtmlFacade',
And then refresh the page you should find that it should be working.

Categories