I ran composer install --no-dev before having to manually deploy to a client's server by FTP that lacks SSH access. When I did so, I received the following error:
PHP Fatal error: Class 'Way\Generators\GeneratorsServiceProvider' not found in C:\www\test.dev\laravel\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php on line 158
PHP Stack trace:
PHP 1. {main}() C:\www\test.dev\laravel\artisan:0
PHP 2. require_once() C:\www\test.dev\laravel\artisan:30
PHP 3. require() C:\www\test.dev\laravel\bootstrap\start.php:60
PHP 4. Illuminate\Foundation\ProviderRepository->load() C:\www\test.dev\laravel\vendor\laravel\framework\src\Illuminate\Foundation\start.php:210
PHP 5. Illuminate\Foundation\ProviderRepository->compileManifest() C:\www\test.dev\laravel\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php:58
PHP 6. Illuminate\Foundation\ProviderRepository->createProvider() C:\www\test.dev\laravel\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php:122
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'Way\\Generators\\GeneratorsServiceProvider' not found","file":"C:\\Ampps\\www\\test.dev\\laravel\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\ProviderRe
pository.php","line":158}}Script php artisan clear-compiled handling the pre-update-cmd event returned with an error
[RuntimeException]
Error Output: PHP Fatal error: Class 'Way\Generators\GeneratorsServiceProvider' not found in C:\www\test.dev\laravel\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php on line 158
PHP Stack trace:
PHP 1. {main}() C:\www\test.dev\laravel\artisan:0
PHP 2. require_once() C:\www\test.dev\laravel\artisan:30
PHP 3. require() C:\www\test.dev\laravel\bootstrap\start.php:60
PHP 4. Illuminate\Foundation\ProviderRepository->load() C:\www\test.dev\laravel\vendor\laravel\framework\src\Illuminate\Foundation\start.php:210
PHP 5. Illuminate\Foundation\ProviderRepository->compileManifest() C:\www\test.dev\laravel\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php:58
PHP 6. Illuminate\Foundation\ProviderRepository->createProvider() C:\www\test.dev\laravel\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php:122
Each of the app.php files has the line 'Way\Generators\GeneratorsServiceProvider'.
This was working fine before running that composer command. Why did this happen and how can it be fixed?
Laravel 4.1.
In your composer.json file, you have way/generators as a development machine dependency only. If you have the service provider 'Way\Generators\GeneratorsServiceProvider' in each of the app.php file, then it would mean that way/generators is a development machine as well as the deployment machine dependency. By doing composer install --no-dev, you're saying that the packages that are development machine dependency only, shouldn't go in the vendor directory, which means that the package way/generators is not installed in the vendor directory. That's why you're getting the error.
Since way/generators is a development dependency only, you should remove 'Way\Generators\GeneratorsServiceProvider' from app/config.php, so that the deployment machine wouldn't look for it.
Also if you're working on the development machine and performed composer install --no-dev, the way/generators package wouldn't be installed in the vendor directory and you'd get the above error. So you'd have to make the development machine environment as not local to test whether or not it'd work in the deployment machine.
Related
I have a project that I need to edit. To see this project, I wanted to run it on localhost and ran it from wamp. Later, when I entered localhost, I got the error.
On top of that, I wanted to run it from cmd and see it. The response I got at that time was as follows.
Fatal error: Uncaught Error: Failed opening required 'C:\wamp64\www/vendor/autoload.php' (include_path='.;C:\php\pear') in C:\wamp64\www\artisan:18
Stack trace:
#0 {main}
thrown in C:\wamp64\www\artisan on line 18
check if there is any /vendor/autoload.php file in your wamp folder if not try composer install in the terminal where your project is located. (if you don't have composer install the composer first via this url)
you can start your project directly with php artisan serve too. if php is added to your windows path variables.
I have inherited an old legacy system based off Yii 1.1 which has had multiple development teams working on it for the past 10 years so is a bit of a mess with little to no documentation.
Doctrine Migrations have been used in the past and I can get this working on Docker, however on the live EB/EC2 instance, the migrations files will not run from command line.
Command:
php vendor/bin/doctrine-migrations status
Throws error
PHP Warning: require(/var/app/current/site/vendor/bin/doctrine-migrations.php): failed to open stream: No such file or directory in /var/app/current/site/vendor/bin/doctrine-migrations on line 8
PHP Fatal error: require(): Failed opening required '/var/app/current/site/vendor/bin/doctrine-migrations.php' (include_path='.:/usr/share/pear7:/usr/share/php7') in /var/app/current/site/vendor/bin/doctrine-migrations on line 8
Looking at my local environment versus the live server, no doctrine-migrations.php file has been created in vendor/bin on the dev server, which composer should have created and is the file being looked for. Composer install is run during build on every deployment but I can't figure out why it is not auto-generating this file in the vendor/bin directory - just another file called doctrine-migrations which pretty much just requires doctrine-migrations.php:
#!/usr/bin/env php
<?php
declare(strict_types=1);
namespace Doctrine\Migrations;
require __DIR__ . '/doctrine-migrations.php';
conposer install install bundle declared in your composer.lock file.
Your composer.lock file is generated when doing your first composer install or a composer update or composer require
Difference may occur between your local environment and production environment.
Indeed, on local, composer install install some bundle only needed in dev mode (see your require-dev part in composer.json)
Either the composer.lock file is not up to date with your composer.json file (if composer.json contain the required bundle) either the required bundle is set as require-dev
To install it, you can run composer install doctrine/doctrine-migrations-bundle
I'm trying to include and use Markdownify in my PHP script on a local server in windows 10, but it does not work.
I have WAMP64 server installed, on which I run my PHP files locally.
I've downloaded Composer and installed it.
During Composer installation I picked php.exe from my WAMP64 server when prompted.
In a CMD I have then entered "composer require pixel418/markdownify", the command was recognized and completed.
Now I try to define in my PHP code:
$converter = new Markdownify\Converter;
but it does not work. Instead I get the error message:
Fatal error: Uncaught Error: Class 'Markdownify\Converter' not found in D:\wamp64\www\mysite\investigate.php:16 Stack trace: #0 {main} thrown in D:\wamp64\www\mysite\investigate.php on line 16
Any hint on how to make this work?
You need to add these lines in your script so PHP knows where to get the classes from
namespace Markdownify;
use Markdownify\Converter;
I am trying to int Zend framework 2. I aready have xampp running. I followed the steps on this answer. How ever when I visit the url I specified I get the following descriptive error:
Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to load ZF2. Run php composer.phar install or define a ZF2_PATH environment variable.' in C:\xampp\htdocs\ZendSkeletonApplication\init_autoloader.php:51 Stack trace: #0 C:\xampp\htdocs\ZendSkeletonApplication\public\index.php(18): require() #1 {main} thrown in C:\xampp\htdocs\ZendSkeletonApplication\init_autoloader.php on line 51
as the exception states. I went on to run the command php composer.phar install
and nothing happens. nothing displays on th cli to showing anything being installed. and when i run again application i get the same error. Where else can I look and check for errors. Thanks
I am using PHP Version 5.6.8
So what worked for me. I began again from scratch following the tutorial here
Then I still got a "could not open input file: composer.phar" when I ran the command: php composer.phar install
so according to "www.softanalyst.com/zend-2-framework-installation-with-xampp/#comment-883" I need to run the following command:
php -r "readfile('https://getcomposer.org/installer');" | php
which I did and it all worked.
open up your terminal and move To your project using the cd project directory
one type dir composer.phpr and try this one dir composer.json if both file listed than do the next step otherwise download the composer in current directory and run the following command as bellow.
php composer.phar install this comman will install all required dependency from the composer.json file. it will take time as depend on internet speed.
once it's complete than try this link for further steps.this link also having how To install composer And skeleton application.
Github
Twitter
I need to install PHPUnit for a web dev project on my Ubuntu box, but am having serious issues. Using suggestions from various sources, I've installed via pear and tried the following:
Currently, phpunit --version returns
PHPUnit 3.7.20 by Sebastian Bergman
when in /usr/share but throws errors everywhere else.
My include path is
include_path = ".:/usr/share/php:/usr/share/php/PEAR:/usr/share/php/File/Iterator"
I've tried different variations ranging from simple /usr/share/php to the full string above. PEAR is in all caps since that is the folder it is in.
Executing with a test case results in
PHP Warning: require_once(File/Iterator/Autoload.php): failed to open stream:
No such file or directory in /usr/share/php/PHPUnit/Autoload.php on line 64
PHP Stack trace:
PHP 1. {main}() /usr/bin/phpunit:0
PHP 2. require() /usr/bin/phpunit:43
PHP Fatal error: require_once(): Failed opening required
'File/Iterator/Autoload.php'(include_path='/usr/share/php/libzend-framework-php')
in /usr/share/php/PHPUnit/Autoload.php on line 64
pear list -c phpunit returns
Installed packages, channel pear.phpunit.de:
============================================
Package Version State
File_Iterator 1.3.3 stable
PHPUnit 3.7.20 stable
PHPUnit_MockObject 1.2.3 stable
PHP_CodeCoverage 1.2.10 stable
PHP_Invoker 1.1.2 stable
PHP_Timer 1.0.3 stable
PHP_TokenStream 1.1.5 stable
Text_Template 1.1.2 stable
I've confirmed that Autoload.php exist at both php/PHPUnit/ and php/File/Iterator/
My loaded php.ini file is at `/etc/php5/cli.php.ini1 as verified by
php --info | grep "onfiguration"
Any other suggestions would be appreciated.
Search for a file on your computer that is called Autoload.php and is in a file structure like this:
../File/Iterator/Autoload.php
Now open the file that throws the error (/usr/share/php/PHPUnit/Autoload.php in your case) and include a set_include_path statement that points to the absolute path of that file.
You seem to have a very similar problem to what I experienced on Mac OSX. For more information look at this very similar question. If all of this doesn't help, try to install with Composer, which I have heard doesn't have this issue.
For recent projects, I'm using Composer to install PHPUnit and the other related tools. It's quite easy:
## ... rest of the composer.json file
# "php -f composer.phar update --dev" to install
"require-dev": {
"phpunit/phpunit": "3.7.*"
},
I also then have a shell script to actually run the PHPUnit command-line tool from the ./vendor/bin/ directory where a link to the locally installed script is installed.
Like Alister's answer, relying on Composer,
but I prefer to deploy the updated PHPUnit globally across my projects with:
composer.phar global require "phpunit/phpunit=dev-master"
That way, when I am at the root dir of my Symfony project, I can just run
~/.composer/vendor/bin/phpunit -c app/ -v --filter testFireNotifications |tee phpunit.log
That last bit with --filter was to run something selectively (actually, more for fast web automation via crontab, than testing...)
Even on a current Ubuntu 14.04.2 server, the repo is stuck with an outdated PHPUnit 3.7.28 "stable", so I sidestep the OS-provided one with this custom install that won't conflict (I haven't put ~/.composer/vendor/bin in my PATH).