We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Phpstorm Windows - VirtualBox ubuntu phalcon

Good evening phalcon community,

I almost despair of trying to get a working developement enviroment with phalcon. I have to mention my expertise about frameworks is rather low and phalcon is the first one I am trying to get along with.

My setup: My PhpStrom runs on Windows 7, together with a VirtualBox. Inside of the VB a ubuntu is running which provides an apache Webserver and the php installation. I have managed to install phalcon inside of my VB but I fail to setup autocompletion within my Phpstorm. Right now I am getting errormessages (inside Phpstorm) from the "index.php" which was created with the phalcon-devtools while it is running perfectly in my browser.

Can please anybody tell me how I tell my PhpStorm I am using phalcon in my VirtualBox?

Best Regards Queuetewig



85.5k
Accepted
answer

here at the bottom you can find a video. https://docs.phalcon.io/en/latest/reference/tools.html

basiccaly:

you need to download this folder here : https://github.com/phalcon/phalcon-devtools/tree/master/ide/2.0.9/Phalcon

and tell your project: External Library: and add path to the downloaded folder.

edited Feb '16

thanks for the advice, I thought it is maybe possibly to create the connection to my VirtualBox phalcon-devtools, I installed them on Windows aswell and got my problem fixed.

As often I got another problem. The generated index.php uses "define('APP_PATH', realpath('..'));" which points on my VirtualBox and works as intended but my PhpStorm wont be able to locate those files and shows me some "soft errors" again: "$config = include APP_PATH . "/app/config/config.php";".

Is there any workaround on this to let my PhpStorm know where those files are located?



85.5k
edited Feb '16

yea i got the same stupid error, I dont know why it is there, but i dont care since i have few includes in my idnex.php which i never open.

I do care about model autocomplate and few other methods in controller etc which actually works. But I removed some of the warrnings that phpstorm complains about, since its it's problem, not mine :D.

But the key should be in you "remote account" and the definitions of the root path etc. If you play with it for a while i am sure it will be fixed

edited Feb '16

The solution is very simple. You should use DIR instead of realpath(), in Code it looks something like this: define('APP_PATH', DIR . '/../'); realpath gets executed when the code is executed while DIR can be used by your IDE, for example PhpStorm.

*the forum is sucking up my _ just look it up over here: https://php.net/manual/de/language.constants.predefined.php