0

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?

Jeep
  • 21
  • 5
  • check this answer and the comments it is similar to your issue https://stackoverflow.com/a/70674192/2640796 – Talal Feb 26 '22 at 20:38

2 Answers2

0

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();
rzx10r
  • 134
  • 1
  • 1
  • 9
  • Phalcon was installed correctly, I see it in `phpinfo()`. The code above gives me an error: `Fatal error: Uncaught ArgumentCountError: Phalcon\Mvc\Micro::handle() expects exactly 1 argument, 0 given in D:\web\www\phalcon-website.ru\index.php:9 Stack trace: #0 D:\web\www\phalcon.ru\index.php(9): Phalcon\Mvc\Micro->handle() #1 {main} thrown in D:\web\www\phalcon.ru\index.php on line 9`. Maybe the problem is in incorrect installation of Devtools, I used the guide from readme here https://github.com/phalcon/phalcon-devtools and got `vendor/phalcon/devtools` folder instead of `phalcon-devtools`. – Jeep Feb 26 '22 at 12:48
  • $app->handle( $_SERVER["REQUEST_URI"] ); – rzx10r Feb 26 '22 at 15:20
  • So run php -m on power shell see if has any errors, and then on phalcon-dev tools folder run composer install, and put the phalcon folder path on windows environments variables, close and open the power shell and type phalcon – rzx10r Feb 26 '22 at 15:55
0

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

rzx10r
  • 134
  • 1
  • 1
  • 9