Cannot composer install with Symfony in PhpStorm - php

I have a problem with PhpStorm. I had trouble adding the Composer and Symfony commands to PhpStorm.
I receive a message of this style:
Problem Failed to parse output as xml: Error on line 2: Content is not
allowed in prolog.. Command php /root/Downloads/composer.phar list
--format=xml Output Fatal error: Uncaught Error: Class 'DOMDocument' not found in
phar:///root/Downloads/composer.phar/vendor/symfony/console/Descriptor/XmlDescriptor.php:90
Stack trace:
0 phar:///root/Downloads/composer.phar/vendor/symfony/console/Descriptor/XmlDescriptor.php(166):
Symfony\Component\Console\Descriptor\XmlDescriptor->getApplicationDocument(Object(Composer\Console\Application),
NULL)
1 phar:///root/Downloads/composer.phar/vendor/symfony/console/Descriptor/Descriptor.php(55):
Symfony\Component\Console\Descriptor\XmlDescriptor->describeApplication(Object(Composer\Console\Application),
Array)
2 phar:///root/Downloads/composer.phar/vendor/symfony/console/Helper/DescriptorHelper.php(69):
Symfony\Component\Console\Descriptor\Descriptor->describe(Object(Symfony\Component\Console\Output\ConsoleOutput),
Object(Composer\Console\Application), Array)
3 phar:///root/Downloads/composer.phar/vendor/symfony/console/Command/ListCommand.php(81):
Symfony\Component\Console\Helper\DescriptorHelper->describe(Object(Symfony\Component\Console\Ou
in
phar:///root/Downloads/composer.phar/vendor/symfony/console/Descriptor/XmlDescriptor.php
on line 90
Can you help me find the solution please ?

The version of PHP needs to be recent. On macOS by default you may end up with PHP 5.6, and PHPStorm actually choose /usr/bin/php as it's preferred option for commands.

Related

Phalcon\Loader\Loader not found

I have a newly cloned phalcon repository:
software: MacOS
Phalcon: 5.0.0RC4
PHP: 8.1
Zephir: 0.16.0
brew: phalcon#4.1.0
Location: ~/Documents/cphalcon
I am trying to set up my new repository by following the tutorial here.
However when I go to my page at localhost:8000, this error pops up:
Fatal error: Uncaught Error: Class "Phalcon\Loader\Loader" not found in /Users/apple/Documents/cphalcon/public/index.php:16 Stack trace: #0 /Users/apple/Documents/cphalcon/.htrouter.php(15): require_once() #1 {main} thrown in /Users/apple/Documents/cphalcon/public/index.php on line 16
I found some similar thread and they said to check my phpinfo to see if phalcon is there, and it was.
I checked for more materials but couldn't find any other clues.
I also tried changing the call to:
use Phalcon\Loader;
But it was the same
Fatal error: Uncaught Error: Class "Phalcon\Loader" not found in /Users/apple/Documents/cphalcon/public/index.php:16 Stack trace: #0 /Users/apple/Documents/cphalcon/.htrouter.php(15): require_once() #1 {main} thrown in /Users/apple/Documents/cphalcon/public/index.php on line 16
Any clues?
I believe that in version 5 the proper syntax now is Phalcon\Autoload\Loader().
Since Phalcon 5 is still in Release Candidate mode (hence the "RC4" on the version), the docs are still lagging a bit behind.
I've converted a couple of Phalcon 3 and 4 sites, and I found the Phalcon 5.0.0RC4 ChangeLog to be helpful when moving from Phalcon 4 to 5. The move from 3 to 5 is far more involved and requires finding the Phalcon 4 update doc on the Phalcon web site.
I hope this helps.

Phalcon - Class "Phalcon\Config" not found

I've installed Phalcon and trying to create new project: phalcon project store. But instead of this I get these errors:
PHP Fatal error: Uncaught Error: Class "Phalcon\Config" not found in C:\Composer\vendor\phalcon\devtools\src\Builder\Component\AbstractComponent.php:48
Stack trace:
#0 C:\Composer\vendor\phalcon\devtools\src\Commands\Builtin\Project.php(74): Phalcon\DevTools\Builder\Component\AbstractComponent->__construct(Array)
#1 C:\Composer\vendor\phalcon\devtools\src\Script.php(109): Phalcon\DevTools\Commands\Builtin\Project->run(Array)
#2 C:\Composer\vendor\phalcon\devtools\src\Script.php(148): Phalcon\DevTools\Script->dispatch(Object(Phalcon\DevTools\Commands\Builtin\Project))
#3 C:\Composer\vendor\phalcon\devtools\phalcon(65): Phalcon\DevTools\Script->run()
#4 {main}
thrown in C:\Composer\vendor\phalcon\devtools\src\Builder\Component\AbstractComponent.php on line 48
Fatal error: Uncaught Error: Class "Phalcon\Config" not found in C:\Composer\vendor\phalcon\devtools\src\Builder\Component\AbstractComponent.php:48
Stack trace:
#0 C:\Composer\vendor\phalcon\devtools\src\Commands\Builtin\Project.php(74): Phalcon\DevTools\Builder\Component\AbstractComponent->__construct(Array)
#1 C:\Composer\vendor\phalcon\devtools\src\Script.php(109): Phalcon\DevTools\Commands\Builtin\Project->run(Array)
#2 C:\Composer\vendor\phalcon\devtools\src\Script.php(148): Phalcon\DevTools\Script->dispatch(Object(Phalcon\DevTools\Commands\Builtin\Project))
#3 C:\Composer\vendor\phalcon\devtools\phalcon(65): Phalcon\DevTools\Script->run()
#4 {main}
thrown in C:\Composer\vendor\phalcon\devtools\src\Builder\Component\AbstractComponent.php on line 48
My PHP version is 8.0.8 Thread Safe x64, I've installed PSR extension and Phalcon 5.0.0 from here: https://github.com/phalcon/cphalcon/releases/tag/v5.0.0beta3, file phalcon-php8.0-ts-windows2019-vs16-x64.zip, that means I have compatible version of framework. phalcon.bat was added to environment variables. What's the problem?
Usually this error occurs when the extension is not loaded by php, see with phpinfo(), also run the componser install insider phalcon-devtools, but probably it is the php not loading the phalcon extension or PHP is not in the windows PATH , also check if the php-fpm log does not contain any extension loading errors, test in cmd the command php -v
also create a index.php and try it
<?php
use Phalcon\Mvc\Micro;
$app = new Micro();
$app->get('/', function () { echo "<h1>test</h1>";});
$app->handle();
Try do the following Go to Edit The system environment variables -> system variables -> path -> edit add phalcon.bat folder path testing here i used C:\Users\renato\Downloads\phalcon-devtools-4.2.0\phalcon-devtools-4.2.0 ( just path folder where the .sh/.bat it is, do not include the file and extension) and worked fine with php 8.0.16 windows 10 phalcon 5
and then go to the power shell and input phalcon
https://helpdeskgeek.com/windows-10/add-windows-path-environment-variable/
Do not forget to run composer install inside phalcon devtools folder.
also on powershell input php -m to see the loaded modules and if it has an error

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 ...

Zend Framework Installation on xampp errors

I am trying to install zend on xampp and l am continuosly getting errors.
Firstly l am getting:
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in C:\xampp\htdocs\zend\ZendSkeletonApplication\public\index.php on line 24
Line 24 is as follows:
if (! class_exists(Application::class)) {
I solved this by making Application::class a string.
then l got the second error below:
Warning: include(C:\xampp\htdocs\zend\ZendSkeletonApplication\public/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\zend\ZendSkeletonApplication\public\index.php on line 22
Warning: include(): Failed opening 'C:\xampp\htdocs\zend\ZendSkeletonApplication\public/../vendor/autoload.php' for inclusion (include_path='.;\xampp\php\PEAR') in C:\xampp\htdocs\zend\ZendSkeletonApplication\public\index.php on line 22
Fatal error: Uncaught exception 'RuntimeException' with message 'Unable to load application. - Type composer install if you are developing locally. - Type vagrant ssh -c 'composer install' if you are using Vagrant. - Type docker-compose run zf composer install if you are using Docker. ' in C:\xampp\htdocs\zend\ZendSkeletonApplication\public\index.php:25 Stack trace: #0 {main} thrown in C:\xampp\htdocs\zend\ZendSkeletonApplication\public\index.php on line 25
where am l supposed to find the vendor folder with the autoload page? I would lie to solve to it today , lol, l have been attempting it for days unend.
Thank you in advance for your assistance
Using Composer is the recommended way to install Zend Framework (this creates the vendor folder). Personally I've never done this using Windows, but there are some instructions here which should help: https://docs.zendframework.com/tutorials/getting-started/skeleton-application/#windows-users-using-wamp
From the look of the first error message in your question, the version of PHP you're running is too low to run the current version of ZF, so you might need to upgrade PHP first. (Composer would normally tell you this during installation.)

Using composer with php in non standard location

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.

Categories