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

Phalconphp using php builtin server

Hi...

I try to run phalconphp app on my mac using php builtin server already follow https://docs.phalcon.io/en/latest/reference/built-in.html to accommodate .htaccess requirement but still application can't run well...always got this error "Please enable rewrite module on your web server to continue"

if point the webfoot to public folder of the falcon application then no controller can run always redirect to index "You're now flying with Phalcon. Great things are about to happen!"

Any clue for this problem?



1.9k
Accepted
answer

after trying 1 hours... it solved with webroot should point to public folder and .htrouter.php copied there...

thanks

edited Mar '14

Hi...

I got a similar trouble around pagination with using PHP Built-in Server and .htrouter.php.

With using .htrouter.php described at https://docs.phalcon.io/en/latest/reference/built-in.html

<?php
if (!file_exists(__DIR__ . '/' . $_SERVER['REQUEST_URI'])) {
    $_GET['_url'] = $_SERVER['REQUEST_URI'];
}
return false;

It doesn't work for pagination in INVO sample application with url like https://localhost/products/search?page=2 With above script the page will be forced to redirect to Home url.

I tried to separate url and get parameters, after that it works fine for me.

<?php
if (!file_exists(__DIR__ . '/' . $_SERVER['REQUEST_URI'])) {
    list($url, $other) = explode('?', $_SERVER['REQUEST_URI']);
    $_GET['_url'] = $url;
    if ($other) {
        $params = explode('&', $other);
        foreach ($params as $param) {
            list($key, $value) = explode('=', $param);
            $_GET[$key] = $value;
        }
    }
}
return false;

I'm not sure it is correct way or not. If someone knows more better way, please correct me.

Thanks

If tried both version of .htrouter.php but itgives me this error

[Mon Jul 7 14:29:30 2014] PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 [Mon Jul 7 14:29:30 2014] PHP Fatal error: Unknown: Failed opening required '.htrouter.php' (include_path='.:/usr/share/php:/usr/share/pear') in Unknown on line 0

can anyone help me?