Re: PHP and javascript

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

 



On Fri, 2010-01-15 at 14:07 -0500, Andres Gonzalez 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
> 


I wouldn't recommend doing it this way at all. What you'd essentially
need, is Javascript make an AJAX request to a server script, which would
then call your PHP shell script, which would then return data to the
[other language] server script, that responds back to the Javascript on
the browser.

What sort of server will you be using that you can' support PHP on it?
PHP runs on most web servers out there, and will happily run alongside
other language modules on a single server.

Who's making the decisions about the new server? Someone really needs to
explain to him/her that it's a massive project converting a website from
one language to another (I've had to convert a large ColdFusion one to
PHP before, so I know) and it will probably cost more in the long term
to convert than might be saved on whatever server 'deal' they're
getting.

Thanks,
Ash
http://www.ashleysheridan.co.uk



[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