Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

demo on PORT 8888 ??

posted by rigagoogoo 10 years ago

Hi Library looks very inviting to use so I've downloaded your demo site and I'm trying to run it on MAMP.

however it keeps falling over because the MAMP server uses port 8888 and for some reason fURL::getdomain() is not capturing this? I'm using a etc/hosts file to map the chosen domain name to localhost and I've setup an apache virtual host to give the project it's own DOCUMENT_ROOT

I can *fix* this by *not* using virtual hosts or by configuring MAMP to use PORT 80 but given this is my dev environment I'd like to be able to run it on port 8888 on a virtual host. ( it strikes me I may have configured my virtual host incorrectly. but I followed instructions on the MAMP forum)

I can partially fix the problem by changing

<base href="<?php echo fURL::getDomain() .URL_ROOT ?>" />

to

<base href="<?php echo fURL::getDomain() . ':8888'.URL_ROOT ?>" />

but then that doesn't fix the submit button link on the login form. I expect it will break all links in forms used by fURL but I didn;t think it worthwhile pursuing in case I'm missing something obvious.

I'm a total Newb to this PHP stuff so not sure how to debug properly. I had to forcible break the page to cause it to dump server array by commenting out //$action = fRequest::get('action'); from the login.php file (incidentally how do i do that at will, dump the server array to screen?)

This showed

 [HTTP_HOST] => dev.ircp:8888
    [SERVER_NAME] => dev.ircp
    [SERVER_ADDR] => 127.0.0.1
    [SERVER_PORT] => 80

looking at this I can guess that fURL::getdomain() is using the SERVER_PORT variable whereas the port apache is actually using (or is it?) is defined in the HTTP_HOST

Many thanks for your time and sorry for such a long post the full SERVER array is below :-)


Riga

full output ------------------------------- $

_SERVER: Array
(
    [REDIRECT_STATUS] => 200
    [HTTP_ACCEPT_LANGUAGE] => en
    [HTTP_ACCEPT_ENCODING] => gzip, deflate
    [HTTP_COOKIE] => PHPSESSID=4396118e9b0ed45dc6640dacd4310c59
    [HTTP_REFERER] => http://dev.ircp:8888/
    [HTTP_USER_AGENT] => Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_4_11; en) AppleWebKit/531.9 (KHTML, like Gecko) Version/4.0.3 Safari/531.9
    [HTTP_CACHE_CONTROL] => max-age=0
    [HTTP_ACCEPT] => application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
    [HTTP_CONNECTION] => keep-alive
    [HTTP_HOST] => dev.ircp:8888
    [PATH] => /usr/bin:/bin:/usr/sbin:/sbin
    [SERVER_SIGNATURE] => <address>Apache/2.0.63 (Unix) PHP/5.2.10 DAV/2 Server at dev.ircp Port 80</address>
  
    [SERVER_SOFTWARE] => Apache/2.0.63 (Unix) PHP/5.2.10 DAV/2
    [SERVER_NAME] => dev.ircp
    [SERVER_ADDR] => 127.0.0.1
    [SERVER_PORT] => 80
    [REMOTE_ADDR] => 127.0.0.1
    [DOCUMENT_ROOT] => /Users/me/Sites/htdocs1
    [SERVER_ADMIN] => you@example.com
    [SCRIPT_FILENAME] => /Users/me/Sites/htdocs1/login.php
    [REMOTE_PORT] => 54411
    [REDIRECT_QUERY_STRING] => action=log_in
    [REDIRECT_URL] => /log_in
    [GATEWAY_INTERFACE] => CGI/1.1
    [SERVER_PROTOCOL] => HTTP/1.1
    [REQUEST_METHOD] => GET
    [QUERY_STRING] => action=log_in
    [REQUEST_URI] => /log_in
    [SCRIPT_NAME] => /login.php
    [PHP_SELF] => /login.php
    [REQUEST_TIME] => 1254935067
    [argv] => Array
        (
            [0] => action=log_in
        )
  
    [argc] => 1
)

$_POST: Array
(
)

$_GET: Array
(
    [action] => log_in
)

$_FILES: Array
(
)

$_SESSION: Array
(
    [fCRUD::/manage::previous_sort_column] => date
    [fCRUD::/manage::previous_sort_direction] => desc
    [fAuthorization::user_token] => 1
)

$_COOKIE: Array
(
    [PHPSESSID] => 4396118e9b0ed45dc6640dacd4310c59
)
Notice
------
{doc_root}/login.php(8)
Undefined variable: action
Notice
------
{doc_root}/login.php(18)
Undefined variable: action

The demo zip file had quite an old version of Flourish in it (r536 I believe). The bug with not including the port number has since been fixed. I uploaded a new version of the demo zip that includes the latest version of Flourish (r718). You can download the new zip at http://static.flourishlib.com/flourish_demo_site_r718.zip.

posted by wbond 10 years ago

hmm I cloned from github just today and replaced the flourish files in the demo with them so it should be a latest revision should it not or are there actual changes to the demo as well? i noticed the demo was not available on github which is a shame?

incidentally how can i tell which revision I have from the source files tehmselves?

appreciate the help :-)

posted by rigagoogoo 10 years ago

err bow head in shame

I've tried with both the zip and the github clone and they both work fine with port 8888

the zip does include a nice revision file though.

now i have a problem with add and delete :-) both urls just hang and throw no exception. I'll have a little play then post another topic if I can;t figure it out :-)

cheers for your help

posted by rigagoogoo 10 years ago

I just discovered Flourish today (4/25/2011), and decided to download only the demo.

My environment is Windows 7 64-bit, with XAMPP 1.7.3, running on port 85.

To get the demo to work (the stylesheet did not get picked up), I had to put a 'hack' in the config.php file that accompanied the demo as follows:

// 2011.04.25
// Revised original code in order to ensure that an installation with a non-standard port (85) works correctly
// The hack below fails when attempting to enter administrative mode.

/*
Original Code:

define('DOC_ROOT', realpath(dirname(__FILE__) . '/../'));
define('URL_ROOT', substr(DOC_ROOT, strlen(realpath($_SERVER['DOCUMENT_ROOT']))) . '/');
*/

define('DOC_ROOT', realpath(dirname(__FILE__) . '\\\\..\\\\'));
define('URL_ROOT', ':85/' . substr(DOC_ROOT, strlen(realpath($_SERVER['DOCUMENT_ROOT'])) + 1) . '/');

The user view of the blog seems to work fine now (the resulting URL is

#!text/html
http://localhost:85/flourish-demo/

). However, it's obvious that my 'hack' causes problems when I attempt to access the admin portion of the app (and probably messes up routing in general). The initial URL after authenticating is:

#!text/html
http://localhost/flourish-demo/log_in:85/flourish-demo/manage

What's the correct way to set up the demo when using a port other than 80? I've been eager to work with the demo in order to get a taste of Flourish before diving into the documentation (which accounts for this dumb question).

Thanks!

P.S. I tried searching for other entries related to the demo and non-standard ports; this thread seemed to be the most appropriate.

posted by anonymous 8 years ago

Replying to my previous message...

This time I downloaded a fresh copy of the demo and installed it, unchanged, on another machine. The second machine also runs Windows 7 (Pro, as opposed to Ultimate on the first machine). This time the blog displays correctly, with the expected stylesheet-controlled look and feel, however, when I log into the admin environment on the second machine, I get a bad URL:

#!text/html
http://localhost:85/flourish-demo/log_in%5Cflourish-demo/manage

The difference: the second machine has a newer version of XAMPP (1.7.4).

I guess there are differences in the PHP versions (PHP 5.3.5 is in the 1.7.4 release of XAMPP; I think PHP PHP 5.3.1 is in the 1.7.3 release of XAMPP).

Not sure how this should be resolved...

posted by anonymous 8 years ago

Hmm, I haven't had issues with non-standard ports and Flourish before, but I also don't normally use the <base> tag. Can you check the generated HTML and see what the <base> tag in your <header> is set to? It should include the port number. If not, you may have stumbled upon a bug in Flourish with XAMMP.

I suppose it is also possible some browsers don't obey a port number in the <base> tag.

posted by wbond 8 years ago

The base tag on the default page that is displayed after submitting this URL,

#!text/html
http://localhost:85/flourish-demo/

, is as follows:

#!text/html
<base href="http://localhost:85/flourish-demo/" />

The same tag value exists on the Login page.

After I supply the correct credentials and click Login, I get an IIS error page (IIS is running on port 80 on this machine, while Apache is on port 85) that shows this URL:

#!text/html
http://localhost/flourish-demo/log_in:85/flourish-demo/manage

in the browser address area.

The odd thing is that occasionally, after having logged in, I can return to the default page via my browser's back button, click the Manage hyperlink and get the expected display of blog entries to manage. At the moment, I'm unable to reproduce that behaviour, however.

Thanks.

posted by anonymous 8 years ago