profoundui and php scripts

Use this board to ask questions or have discussions with other Rich Displays users.
Post Reply
Orin
Profound User
Posts: 20
Joined: Fri Aug 03, 2012 8:43 am
First Name: Orin
Last Name: Parris
Company Name: Banks DIH Limited
Country: Guyana
Contact:

profoundui and php scripts

Post by Orin »

Where can i place a php script within the profoundui file structure so that it can be parsed as a regular php script? Is this even possible using the profoundui in it's latest release out of the box?

My issue is that I am submitting a form via ajax but given the limitation of cross domain (ports, etc) communication I am having some errors. My php script is going to create a file within the profoundui file structure.

Thanks for the speedy reply.
User avatar
David
Profound Logic Staff Member
Posts: 690
Joined: Fri Jan 04, 2008 12:11 pm
First Name: David
Last Name: Russo
Company Name: Profound Logic Software
Contact:

Re: profoundui and php scripts

Post by David »

An easy way to run PHP scripts under Profound UI's http server is to setup the http server as a reverse proxy for your ZENDCORE or ZENDSVR http server.

Our installer can set this up for you (under the Customize) options, but if you didn't do that during installation, you can add these lines to your "httpd.conf":

Code: Select all


ProxyPass /php/ http://127.0.0.1:PORT/             
ProxyPassReverse /php/ http://127.0.0.1:PORT/

Just fill in the appropriate port number.

There are some LoadModule directives required for the above, but if you are running a fairly recent version of Profound UI, these should already be in the configuration, regardless of how it was installed.

You'll then need to end/restart the http server to make this effective. After that is done, you can launch PHP scripts with paths lke this:

Code: Select all


/php/yourpath/yourscript.php

Where "/yourpath" is the path within the document root of your Zend Core or Zend Server http server.

Apache will fetch the content on the backend, so the browser will see the path as being on the same http server, and you can then make Ajax calls with no problem.
Orin
Profound User
Posts: 20
Joined: Fri Aug 03, 2012 8:43 am
First Name: Orin
Last Name: Parris
Company Name: Banks DIH Limited
Country: Guyana
Contact:

Re: profoundui and php scripts

Post by Orin »

thanks for the reply David,

I have looked at my "httpd.conf" file in my profoundui installation and those lines are already added with the port that my zendsvr is listening on.

and I understand that my script should be placed in my zendsvr's document root. Do I need to place the file into a folder within my zendsvr document root?
Or can i just place it at the document root level?

Also how do i call the script? what should be the URL?
User avatar
David
Profound Logic Staff Member
Posts: 690
Joined: Fri Jan 04, 2008 12:11 pm
First Name: David
Last Name: Russo
Company Name: Profound Logic Software
Contact:

Re: profoundui and php scripts

Post by David »

You can put the script in /www/zendsvr/htdocs, or any sub-directory. Then give the path after /php as the directory structure within htdocs.

For example file "my.php" in /www/zendsvr/hdtocs:

/php/my.php

For example file "my.php" in /www/zendsvr/htdocs/mydir:

/php/mydir/my.php
Orin
Profound User
Posts: 20
Joined: Fri Aug 03, 2012 8:43 am
First Name: Orin
Last Name: Parris
Company Name: Banks DIH Limited
Country: Guyana
Contact:

Re: profoundui and php scripts

Post by Orin »

so the URL used to call or point to the script within/using profoundui is "<server ip>:<profound_port>/php/my.php" or "<server ip>:<profound_port>/profoundui/php/my.php"?

(with the script inside of /www/zendsvr/htdocs)
Orin
Profound User
Posts: 20
Joined: Fri Aug 03, 2012 8:43 am
First Name: Orin
Last Name: Parris
Company Name: Banks DIH Limited
Country: Guyana
Contact:

Re: profoundui and php scripts

Post by Orin »

Thanks David,

I tried what you suggested and it worked. I realized what the URL would be. Thanks again. Cheers
User avatar
David
Profound Logic Staff Member
Posts: 690
Joined: Fri Jan 04, 2008 12:11 pm
First Name: David
Last Name: Russo
Company Name: Profound Logic Software
Contact:

Re: profoundui and php scripts

Post by David »

Glad that helped! If you are calling the script from your browser directly to test it, you can use:

http:<server>:<profoundui port>/php/my.php

From your PUI apps, though, you would want to use:

/php/my.php

When run from the PUI page like that, the browser assumes the same http server, so specifying it is not necessary, and in most cases is actualy undesirable, as it's then hard coded into the link, and then may not do what you want if you run the same app on a different http server.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest