Let's get started with Phalcon webtools

Hello,
I'm Mandai, the Wild Team member of the development team.

I previously wrote a blog post about the phalcon command, but unfortunately it has so many options that it seems like it would take some time to master it

In such cases, it might be a good idea to learn phalcon commands little by little later and try using the quick and easy phalcon webtools

Create a project that can use phalcon webtools

If you want to enable webtools from scratch in a new project that has not yet been created, the command is as follows:

phalcon project --name [project-name] --enable-webtools

 

Installing phalcon webtools into an existing project

You can also add webtools to an already created phalcon project

phalcon webtools --enable

 

Uninstall phalcon webtools

There will come a time when you no longer need webtools, such as when you have completed configuration or development.
In that case, you can easily uninstall it using the phalcon command.

phalcon webtools --disable

 

Try displaying the top page

Once you have enabled webtools, try viewing it in your browser.
If you have set the document root of your web server to public, you can access it at http://localhost/webtools.php

If something is displayed but the stylesheet is not working properly, add write permissions to public/css and public/js and access webtools.php again

cd /path/to/project_root/public/ chmod a+w css js

The actual CSS and JS files are stored in the resources directory in phalcon-devtools, and are copied to the development environment the first time a request is made.
If you do not have write permission to the directory, the files cannot be copied.

Here is the homepage with all the necessary elements included

This was created with Phalcon dev-tools 3.0.4, and the layout has changed significantly from previous versions

There have also been some changes to the functionality, and config settings can no longer be made from webtools.
Therefore, database settings and other settings must be configured outside of webtools in advance.

 

If you can't access

There are probably several patterns, but I'll list the ones I've encountered

 

Access from IP addresses other than those set in webtools.config.php

In this case, you will encounter a screen like this:

The file webtools.config.php generated under public contains the IP addresses that can be accessed

By default, the range is set to 192.168.0.0/16.
I happened to want to take a screenshot and wanted to access it from outside VirtualBox, but this setting caused me to get stuck.

 

If the link is somehow wrong

There are several links on the top page, but if they are in the format of "/webtools.php/webtools.php?_url=/info", check the baseUri setting.
If the document root is set to "project root + public", there is no need to set baseUri in config/config.php, so just set it to "/".

invo which is also introduced in the official documentation , /invo/ is set.

 

When creating a controller or model, I get the error "An unexpected error has occurred."

This is the same reason why CSS and JS cannot be loaded: you do not have write permissions to the controller or model directories

I often have trouble with the lack of write permissions in the local environment, but after tweaking directory permissions during development, it's a hassle to go back and reset them when moving to the production environment, so changing the execution user on the web server side might be one solution.
Also, if you grep /var/log/messages with "SELinux" and find it, it means that SELinux is interfering with something.

sudo setenforce 0

There are also some taboo moves that involve:

That's all

If you found this article useful, please click [Like]!
0
Loading...
0 votes, average: 0.00 / 10
1,343
X Facebook Hatena Bookmark pocket

The person who wrote this article

About the author

Yoichi Bandai

My main job is developing web APIs for social games, but I'm also grateful to be able to do a variety of other work, including marketing.
My portrait rights within Beyond are CC0.