Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Phalconphp using php builtin server

Hi...

I try to run phalconphp app on my mac using php builtin server already follow http://docs.phalconphp.com/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.3k
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 http://docs.phalconphp.com/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 http://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?