Re: PHP and javascript

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To do what you want that new httpd server should at least be able to
call up PHP via cli / whatever, and retrieve the output.
It also needs to provide what's in php called $_GET and $_POST.

Assuming you got that covered, then yes, you could route the calls via
ajax (i recommend jquery.com for that) to your non-php httpd, which
then forwards it (and the results back).
What i'd do if it HAD to be done this way, is pass a couple of extra
variables in each call from javascript. It's best to route all the
ajax calls to php to the same script on the non-php httpd, so you'd
need at least the "relative path (from serverside defined absolute
base-path for your php subsystem) to the script being called" (or even
an MD5/SHA256 of this rel path, if you're on the paranoid side; you
then inform (via an array) the non-php httpd about all the scripts
that may be called from javascript, without giving up the scripts
names to spies along the line)

But tbh, whoever thought of changing the type of server used and
thereby giving you this new problem, should have also thought of how
to not-dump tons of existing code. Not to mention developer experience
with a specific language.

If this new httpd is so damn good at something that it has to be used,
it still doesn't mean it has to be used for the entire system either.
You might be giving it more work than it is comfortable with, that
way.

So depending on your backend size (in terms of number of machines
used) & setup, you might even campaign to keep an apache in the
picture and let it perform work on the database / file storage
system..

On Fri, Jan 15, 2010 at 8:07 PM, Andres Gonzalez <andres@xxxxxxxxxxxxxxx> wrote:
> How do I call PHP code that will run server side, from javascript code that
> is running client side?
>
> I have a lot of PHP server side code written and working within CodeIgniter.
>  Now, my project
> has changed and (for reasons unimportant to this discussion) we are now NOT
> going to
> use apache and CodeIgniter, but instead, we are going to have to use an http
> server that does
> not support PHP internally.  But I want to reuse my original PHP code. So I
> am thinking that I
> can execute the PHP code via a command line interface using the PHP cli
> interface instead of
> the PHP cgi interface. But, I will have to initiate this serversid call via
> javascript code running
> on the client.
>
> I know...kind of convoluted. But how would one do this if necessary?
>
> -Andres
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux