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

Phalcon webtools 403 error (Forbidden :: Phalcon WebTools)

  1. I created a phalcon project on the server in the directory /home/admin/web/mysite.com/public_html/test

  2. Installed devtools in the directory /home/admin/phalcon-devtools

  3. I configured apache2.conf openbasedir to access /home/admin/phalcon-devtools directory.

  4. Assigned PTOOLS_IP value in webtools.config.php to "46." (My ip address subnet) .

  5. The owner of the directory and files in /home/admin/phalcon-devtools is the same as the site folder /home/admin/web/mysite.com/public_html/test (admin:admin)

I follow the link mysite.com/test/webtools.php and get an error 403:

403 Forbidden

Sorry! You are not allowed to access this page.

Apparently, this is a mistake of the Phalcon, because the error page is displayed through the Falcon template and the page title is "Forbidden :: Phalcon WebTools".

The site itself based on the Phalcon is working correctly (mysite.com/test/)

Please, help me setup the Phalcon webtools to work correctly.



43.9k
edited Mar '17

Hi,

try provide the full ip adress in public/webtools.config.php

be carefull, if you have install phalcon and phalcon-devtools on an online host and try to access to it trough your personnal computer, the ip adress you should provide is the one that was assigned to you by your internet provider and not the one you have in your local network

otherwise disable check access via IP address just remove the 'ptools_ip' key in public/webtools.php (really bad idea if you're in the case of an online server)


$bootstrap = new Bootstrap([
    'ptools_path' => PTOOLSPATH,
   // 'ptools_ip'   => PTOOLS_IP, // <---- Here
    'base_path'   => BASE_PATH,
]);
edited Mar '17

I removed ptools_ip, cleaned the cache, the situation on the page https://mysite.com/webtools.php did not change... /assets/img/zGi5JZr.png /assets/img/KWB6Glg.png /assets/img/qMSvrgx.png /assets/img/5k49ljw.png

Help!, webtools is not working((



43.9k

are you sure apache is running under the admin user (in console use: ps aucx|grep apache) ?

edited Mar '17

are you sure apache is running under the admin user (in console use: ps aucx|grep apache) ?

It is running under root:

[email protected]:~# ps aucx|grep apache

root 14111 0.0 0.5 149412 24040 ? Ss 12:29 0:00 apache2

Apache2.conf shown above is generated automatically by vestacp. I just added a directory with devtools.



43.9k

try to remove the open_basedir in your apache vhost config

from comments in my php.ini (you can -and that's what yiu're doing- override php.ini general directive in per virtualhost config file):


; open_basedir, if set, limits all file operations to the defined directory
; and below.  This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file.
; https://php.net/open-basedir
;open_basedir =

I understand that while webtools are outside your web app directory, webtools.php could not access to /home/admin/phalcon-devtools directory.

personnaly, I've never use all your custom config in apache vhost, and I keep them as simple as they are described in the doc :

https://docs.phalcon.io/en/latest/reference/apache.html



4.1k
Accepted
answer
edited Mar '17

try to remove the open_basedir in your apache vhost config

from comments in my php.ini (you can -and that's what yiu're doing- override php.ini general directive in per virtualhost config file):


; open_basedir, if set, limits all file operations to the defined directory
; and below.  This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file.
; https://php.net/open-basedir
;open_basedir =

I understand that while webtools are outside your web app directory, webtools.php could not access to /home/admin/phalcon-devtools directory.

personnaly, I've never use all your custom config in apache vhost, and I keep them as simple as they are described in the doc :

https://docs.phalcon.io/en/latest/reference/apache.html

The problem was in incorrect $_SERVER['REMOTE_ADD'] value - apache2 rpaf_module not worked propertly and the IP was wrong. According to Phalcon devtools sources $_SERVER['REMOTE_ADD'] is used to determine user IP.

edited Mar '19

For people visiting this later, edit webtools.config.php and put the ip address for whatever $_SERVER['REMOTE_ADDR'] will read when you visit webtools. Or if you want to allow all traffic in, you can do:

defined('PTOOLS_IP') || define('PTOOLS_IP', $_SERVER['REMOTE_ADDR']);