I cannot run the composer command. I'm using windows cmd.
Inside C:\ProgramData\ComposerSetup\bin, I can do php composer.phar and it works.
But if do composer or composer.bat, I get this :
PHP Warning: Phar::mapPhar(/cygdrive/c/ProgramData/ComposerSetup/bin/c:\ProgramData\ComposerSetup\bin\composer.phar): failed to open stream: No such file or directory in /cygdrive/c/ProgramData/ComposerSetup/bin/c:\ProgramData\ComposerSetup\bin\composer.phar on line 23
PHP Fatal error: Uncaught exception 'PharException' with message 'unable to open phar for reading "/cygdrive/c/ProgramData/ComposerSetup/bin/c:\ProgramData\ComposerSetup\bin\composer.phar"' in /cygdrive/c/ProgramData/ComposerSetup/bin/c:\ProgramData\ComposerSetup\bin\composer.phar:23
Stack trace:
#0 /cygdrive/c/ProgramData/ComposerSetup/bin/c:\ProgramData\ComposerSetup\bin\composer.phar(23): Phar::mapPhar('composer.phar')
#1 {main}
thrown in /cygdrive/c/ProgramData/ComposerSetup/bin/c:\ProgramData\ComposerSetup\bin\composer.phar on line 23
What's wrong ?
I'm using the cygwin php in my path (cygwin/bin).
It works if I use a new php installation. But I want to keep "cygwin/bin" in my path.
I found it !
Removing "c:\cygwin64\bin" in the path.
Adding new php installation in path : "c:\php"
Adding new system variable : "CYGWIN_HOME", with value c:\cygwin64.
This way, using windows cmd, composer will use the php in the path ("c:\php").
And using cygwin, composer will use the php in "cygwin\bin" (because of the CYGWIN_HOME variable).
Related
I'm new using PHP Framework, I got a problem with Laravel PHP artisan serve
php artisan serve
PHP Warning: require(D:\LARAVEL\Login\login3-app/vendor/autoload.php): Failed t
o open stream: No such file or directory in D:\LARAVEL\Login\login3-app\artisan
on line 18
PHP Fatal error: Uncaught Error: Failed opening required 'D:\LARAVEL\Login\logi
n3-app/vendor/autoload.php' (include_path='.;C:\php\pear') in D:\LARAVEL\Login\l
ogin3-app\artisan:18
Stack trace:
#0 {main}
thrown in D:\LARAVEL\Login\login3-app\artisan on line 18
Please help me
You have to run composer install or composer update to install dependencies and create vendor folder inside your app
I'm trying to learn Laravel-The PHP Framework and wanted to use artisan.
I already installed Laravel globally and also created my first project but every time I run php artisan it doesnt recognize the command. I opened git on my project directory and sill not recognized.
It gives me this error:
$ php artisan
PHP Warning: require(C:\Users\--------\Desktop\Project\Laravel\firstProject/vendor/autoload.php): Failed to open stream: No such file or directory in C:\Users\--------\Desktop\Project\Laravel\firstProject\artisan on line 18
Warning: require(C:\Users\--------\Desktop\Project\Laravel\firstProject/vendor/autoload.php): Failed to open stream: No such file or directory in C:\Users\--------\Desktop\Project\Laravel\firstProject\artisan on line 18
PHP Fatal error: Uncaught Error: Failed opening required 'C:\Users\--------\Desktop\Project\Laravel\firstProject/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\Users\--------\Desktop\Project\Laravel\firstProject\artisan:18
Stack trace:
#0 {main}
thrown in C:\Users\--------\Desktop\Project\Laravel\firstProject\artisan on line 18
Fatal error: Uncaught Error: Failed opening required 'C:\Users\--------\Desktop\Project\Laravel\firstProject/vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\Users\--------\Desktop\Project\Laravel\firstProject\artisan:18
Stack trace:
#0 {main}
thrown in C:\Users\--------\Desktop\Project\Laravel\firstProject\artisan on line 18
I tried downloading PHP manually or use the PHP from XAMPP but no changes.
I used php v8.0.2 and composer v2.0.11
You shouldn't install Laravel globally.
Go through this link:
How to Install Laravel on Ubuntu 20.04
On a clean Windows installation I installed PHP 7.2 with Nginx which works fine, both via Nginx as on the commandline. Now, I also want to install PEAR but that will output som PHP errors which don't fully know why the happen.
Bellow the full output of the command php .\go-pear.phar which I got from the official documentation page http://pear.php.net/manual/en/installation.getting.php.
Name of configuration file [C:\WINDOWS\pear.ini] : $prefix
Below is a suggested file layout for your new PEAR installation. To
change individual locations, type the number in front of the
directory. Type 'all' to change all of them or simply press Enter to
accept these locations.
1. Installation base ($prefix) : C:\tools\php
2. Temporary directory for processing : C:\tools\php\tmp
3. Temporary directory for downloads : C:\tools\php\tmp
4. Binaries directory : C:\tools\php
5. PHP code directory ($php_dir) : C:\tools\php\pear
6. Documentation directory : C:\tools\php\docs
7. Data directory : C:\tools\php\data
8. User-modifiable configuration files directory : C:\tools\php\cfg
9. Public Web Files directory : C:\tools\php\www
10. System manual pages directory : C:\tools\php\man
11. Tests directory : C:\tools\php\tests
12. Name of configuration file : C:\tools\php
13. Path to CLI php.exe : C:\tools\php
1-13, 'all' or Enter to continue:
Beginning install...
PHP Fatal error: Uncaught Error: Call to undefined method PEAR_Error::set() in phar://C:/tools/php/go-pear.phar/PEAR/Start.php:322
Stack trace:
#0 phar://C:/tools/php/go-pear.phar/PEAR/Start/CLI.php(72): PEAR_Start->doInstall()
#1 phar://C:/tools/php/go-pear.phar/index.php(5): PEAR_Start_CLI->run()
#2 C:\tools\php\go-pear.phar(1271): require_once('phar://C:/tools...')
#3 {main}
thrown in phar://C:/tools/php/go-pear.phar/PEAR/Start.php on line 322
Fatal error: Uncaught Error: Call to undefined method PEAR_Error::set() in phar://C:/tools/php/go-pear.phar/PEAR/Start.php:322
Stack trace:
#0 phar://C:/tools/php/go-pear.phar/PEAR/Start/CLI.php(72): PEAR_Start->doInstall()
#1 phar://C:/tools/php/go-pear.phar/index.php(5): PEAR_Start_CLI->run()
#2 C:\tools\php\go-pear.phar(1271): require_once('phar://C:/tools...')
#3 {main}
thrown in phar://C:/tools/php/go-pear.phar/PEAR/Start.php on line 322
The answer is actually on a page of the documentation:
https://pear.php.net/manual/en/installation.php
Windows 7 will not allow the installation script to write to c:\windows\pear.ini. It gives the "Fatal error: Call to undefined method PEAR_Error::set()" error. Change the location of the configuration files (#11) to someplace writable, complete the installation, then copy the contents into c:\windows\pear.ini.
A simple solution to this is: Run cmd as administrator.
I am trying to run the server but keep getting these messages when running php app/console server:run:
PHP Warning: require(/var/www/html/symfony_demo/app/../vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/symfony_demo/app/autoload.php on line 11
PHP Stack trace:
PHP 1. {main}() /var/www/html/symfony_demo/app/console:0
PHP 2. require() /var/www/html/symfony_demo/app/console:17
PHP Fatal error: require(): Failed opening required '/var/www/html/symfony_demo/app/../vendor/autoload.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/symfony_demo/app/autoload.php on line 11
PHP Stack trace:
PHP 1. {main}() /var/www/html/symfony_demo/app/console:0
PHP 2. require() /var/www/html/symfony_demo/app/console:17
If I run php bin/console server:run I get this message:
Could not open input file: bin/console
The only change I have made recently was use winSCP to copy my files from the remote server to my local PC. Can someone help me with the errors?
EDIT: Like an idiot I copied over the wrong project.
EDIT: Still didn't fix my issue.
You most likely didn't run composer install or forgot to copy the vendor directory.
I'm trying to use composer on my NAS (a good old D-Link DNS-323 running the incredibly good fonz fun plug 0.7).
I have my php installed in /ffp/bin/php.
When I install composer using the following command
php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/ffp/sbin --filename=composer
But when I do a simple less /ffp/sbin/composer, I have the following shebang set :
#!/usr/bin/env php
<?php
/*
* This file is part of Composer.
*
Unfortunatly, my NAS do not have the /usr/bin/env folder existing on my machine ...
So, how can I have composer referring to the correct php executable ?
Besides, I tried changing the declaration to use #!/ffp/bin/php, but when doing so, any composer run echoes the following result :
PHP Warning: PHP Startup: Unable to load dynamic library '/ffp/lib/php/extensions/no-debug-non-zts-20100525/gd.so' - File not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/ffp/lib/php/extensions/no-debug-non-zts-20100525/gd.so' - File not found in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/ffp/lib/php/extensions/no-debug-non-zts-20100525/sqlite.so' - File not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/ffp/lib/php/extensions/no-debug-non-zts-20100525/sqlite.so' - File not found in Unknown on line 0
PHP Fatal error: Uncaught exception 'PharException' with message 'phar "/mnt/HD_a2/ffp/sbin/composer" has a broken signature' in /mnt/HD_a2/ffp/sbin/composer:23
Stack trace:
#0 /mnt/HD_a2/ffp/sbin/composer(23): Phar::mapPhar('composer.phar')
#1 {main}
thrown in /mnt/HD_a2/ffp/sbin/composer on line 23
Fatal error: Uncaught exception 'PharException' with message 'phar "/mnt/HD_a2/ffp/sbin/composer" has a broken signature' in /mnt/HD_a2/ffp/sbin/composer:23
Stack trace:
#0 /mnt/HD_a2/ffp/sbin/composer(23): Phar::mapPhar('composer.phar')
#1 {main}
thrown in /mnt/HD_a2/ffp/sbin/composer on line 23
Of particular importance is the line
PHP Fatal error: Uncaught exception 'PharException' with message 'phar "/mnt/HD_a2/ffp/sbin/composer" has a broken signature' in /mnt/HD_a2/ffp/sbin/composer:23
How can i fix it ? In other words, how can I have a working php + composer installation on my NAS ?
So, how can I have composer referring to the correct php executable ?
A very simple solution is to create a shell script:
#!/bin/sh
/ffp/bin/php -n /ffp/sbin/composer "$#"
Make it executable, name it composer, put it in your path before /ffp/sbin (or rename /ffp/sbin/composer to composer.phar and update the above script too).
The -n flag tells PHP to not use php.ini. This is useful when there are many extensions loaded from php.ini; not loading them makes composer run faster. Especially xdebug is recommended to not be loaded by composer, for speed improvement.