I'm looking to create a Google Extension for Chrome. I was wondering if it is possible to include a PHP file in the extension. After reading about extensions on Google's developer portal, they only mentioned HTML, CSS, and JavaScript. Nevertheless, is it possible to use PHP in the extension? Help is greatly appreciated.
No. PHP only runs on the server, while the extensions run in the browser. You can, of course, contact your server, but you can't run PHP inside the browser.
No. Well, you can include a PHP file, but it won't be processed because PHP is run on a server. You can make a function in Javascript to contact a PHP script on your server, however.
The google extensions only support HTML, CSS and Javascript files and
this is what is considered a client, while PHP is a server-side
language.
You can find more about Google Extensions here
https://developer.chrome.com/docs/extensions/mv3/architecture-overview/
Related
I designed my web page using ms office frontpage 2003 as I am little bit familiar with that.Later I saved that using php extension as I want to use more php code in there.But soon after i include any php code it only shows the HTML code in the browser.
Your kind consideration given with this regard is highly appreciated.
You seem to be confused about how PHP and HTML work.
Feel free to use whatever text editor you wish, but PHP code will not show up in the browser. This is the intended behavior. PHP is executed server side, and therefore it is completely invisible to the eyes of the clients (browsers.) If you're not using a server with PHP installed, then your PHP code wont execute, obviously, but under no circumstances should you see PHP code in your browser.
Use an editor like Notpad++ (notepad-plus-plus.org), Editpad Pro (www.editpadpro.com) sublime text (www.sublimetext.com) etc. to edit your html files. Go ahead open your .html or .php files in these editors and make appropriate changes.
UPDATE: PHP scripts run on web server. You cannot just open .php files in browser like .html files. For PHP scripts to execute you need to have a web server. Install XAMPP in your system. https://www.apachefriends.org
As in JSP we give "WAR" file to clients and it contains .class files and other configuration files but not the source code, is there any way, in PHP, to deliver the project (website) to client without giving them source code.
Facebook created a project called HipHop php, a php compiler.
See this post:
Can you "compile" PHP code?
Short answer, not really.
I mean you can compile php into a single .phar file however anyone with moderate php knowledge can get the code from that.
There are also solutions http://www.ioncube.com/ though I don't know how easily someone can get the code from it however I would strongly advise against any solution like this as they generally require the user of this "compiled" code to you their proprietary software to run it.
I would like to use PHP in Chrome extensions. I've tried to change background.html to background.php but that doesn't work. How can I do this?
You can't do this. PHP is a server-side language. This would require all your users to install a PHP interpreter, which is not feasible. Perhaps if you used Native Client you would be able to bundle PHP somehow, but that most likely wouldn't be worth it at all.
Read my question thoroughly before responding, I know there’s a site called wonderfl.net
I‘ve got the Flex SDK 4 on my Mac and I found a way to compile AS3 into SWF files using Flex's mxmlc compiler in Xcode, so I wondered, would it be possible to do this sort of simply online? Using for example a language I'm familiar with, PHP?
I thought it’d be a thing that would be interesting to use for a website, or like some private projects.
Thanks in advance!
You have the available tools to do so. You can write the AS3 content posted from the web into files, use PHP's exec function to run mxmlc, then send the resulting .SWF file to the client using PHP's readfile function. You'd just have to make sure mxmlc was present on the web server running the PHP.
I am writing a small web server, nothing fancy, I basically just want to be able to show some files. I would like to use PHP though, and im wondering if just putting the php code inside of the html will be fine, or if I need to actually use some type of PHP library?
http://www.adp-gmbh.ch/win/misc/webserver.html
I just downloaded that and I am going to use that to work off of. Basically I am writing a serverside game plugin that will allow game server owners to access a web control panel for their server. Some features would be possible with PHP so this is my goal. Any help would be appreciated, thanks!
The PHP won't serve itself. What happens in a web server like Apache is before the PHP is served to the user it is passed through a PHP parser. That PHP parser reads, understands and executes anything between (or even ) tags depending on configuration. The resultant output, usually still HTML, is served by the web server.
There are a number of ways to achieve this. Modules to process PHP have been written by Apache but you do not have to use these. PHP.exe on windows, installed from windows.php.net, will do this for you. Given a PHP file as an argument it will parse the PHP and spit the result back out on the standard output.
So, one option for you is to start PHP.exe from within your web server with a re-directed standard output to your program, and serve the result.
How to create a child process with re-directed IO: http://msdn.microsoft.com/en-us/library/ms682499%28VS.85%29.aspx however, you won't be writing the child process, that'll be PHP.exe
Caveat: I am not sure from a security / in production use perspective if this is the most secure approach, but it would work.
PHP needs to be processed by the PHP runtime. I'm assuming the case you're talking about is that you have a C++ server answering HTTP queries, and you want to write PHP code out with the HTML when you respond to clients.
I'm not aware of any general-purpose PHP library. The most straightforward solution is probably to use PHP as a CGI program.
Here's a link that might be useful for that: http://osdir.com/ml/php-general/2009-06/msg00473.html
This method is nice because you don't need to write the HTML+PHP out to a file first; you can stream it to PHP.
You need execute the PHP page to serve the page it generates.
The easiest thing for you to do would be to add CGI support to your webserver in some basic form. This is non-trivial, but not too difficult. Basically you need to pass PHP an environment and input, and retrieve the output.
Once you have CGI support you can just use any executable, including PHP, to generate webpages.