This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Question about php and dreamweaver?
I am having alot of trouble running my php file. I downloaded XAMPP and have both Apache and MySQL running. Do I need to save the file in a certain place, and what does Dreamweaver mean when it says:
To preview pages containing server-side code, you need a testing server. Would you like to specify one now?
I have good enough knowledge in HTML and CSS, and have gotten websites running, but I can't seem to get PHP to work. When I just run the code from google chrome plainly it looks like this:
"Hello World"
"; phpinfo(); ?>
You can put your PHP-files into the xampp/htdocs folder, e.g. xampp/htdocs/hello.php and then open it in your browser at http://localhost/hello.php.
The URL must say localhost or whatever you set it to in order to render a PHP page. You also need to make sure PHP handlers are working and correctly parsing PHP files.
Related
This question already has an answer here:
Why my contact form (php) does not work with GitHub pages?
(1 answer)
Closed 12 months ago.
So i was adding a .php file to my github website with an email sender form, but when i try running it on my website it makes me download it instead of making it run directly in the browser. I was also trying to research something and i saw something about apache, but i don't know how to do it and how it works.
What i tried is to change the extension to .html but unfortunately, it sended me a 405 error "not allowed".
I'm sure the code is right and the only thing is that it dosn't make me run it.
What i want is that the php file, runs on the browser instead of making me download it.
Assuming that by GitHub Website you mean GitHub Pages...
You can't.
GitHub websites are mostly static - you, as a developer, push html or markdown and github provides/generates static content for viewers/browsers.
If you want to have a PHP-based backend, you need to use a different service. Alternatively, if your PHP code can generate static html, you can run it in a github action and push the html into github pages - but once done, it will stay as is until the next run.
Edit: also check the video on their site, which among other things, says:
There are no databases to set up or servers to configure
This question already has answers here:
How can I run a php without a web server?
(4 answers)
Closed 2 years ago.
i know there are many similar questions but tbh none of them really fit.
I have no problems running the php part of my Webpage and everything works fine. Now im asking if there is a way to run my webpage including the php part without using having to start apache and typing in localhost.
I just wanna open up my html document with a browser and display it, nothing else. However then, the php code isnt really executed but its necessary for me as it displays an essential table with data. And no I cant use javascript for a very specific reason. I have to use php for my project but its a bit inconvenient having to start apache everytime and i just want to open up the document with firefox for example.
Unfortunately, this will not be possible as PHP is a server side language. As such, you will have to have an application to serve the content. With HTML, you are able to open it directly and display as the client (Browser) is able to read it directly. Browsers do not read PHP - when the server compiles the PHP, it is only sending the DOM (HTML, etc.) to the browser.
Like other people said, PHP is a server side language so you need to run a server on your machine.
But maybe you could try using small local server like the Symfony Local Server
It should be faster to start than apache.
This question already has answers here:
Website screenshots
(18 answers)
Closed 6 years ago.
I need to take screenshots of few web pages and save them in a folder using php.
I want to do this using a php script, is there a way I can render those webpages and take screenshot of a particular area after the website is fully loadedd? - I'm using windows.
I tried using wkhtmltoimage but it takes low quality screenshots and also it takes the screenshot before the whole page is loaded, so some images of the webpage are not appearing in the screenshot, is there a way to do this using php?
Please help php specialists. Thank you
PHP runs on server side, so to be able to take screenshots you need something to render HTML (a browser-like script) and generate a image of it. This script will do that (wkhtmltoimage too):
HTML2PS:
http://freecode.com/projects/html2ps_php
But I still think the best solution will be using javascript. Of course, only the client will have access to the screenshots, and maybe you can upload the image to the server. A client browser is better than any kind of server script.
If that is the case, I would suggest using HTML2CANVAS:
HTML2CANVAS: http://html2canvas.hertzen.com/
The best server solution will be a linux distribution with a google chrome installation and a local script to take screenshots. That is the only way to get accurate screenshots of a web page that may contain javacript/HTML5/animations and other difficult to render stuff.
JavaScript / HTML5 / Canvas
It could be hard to code it only in PHP. In your case I think I would follow those instructions:
Using HTML5/Canvas/JavaScript to take screenshots
PHP
Or if you really want use only PHP, it should help you:
Website screenshots using PHP
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
PHP auto minify. Is there any?
I'm using PHP minify (http://code.google.com/p/minify/)
I have to go to my webpage, create the url's, click upload, copy the the link of the new compressed file into my PHP file as explained here: http://www.mrclay.org/2008/09/19/minify-21-on-mrclayorg/
This works fine, but how can this be automated? Is there a PHP class for this or can I use one of the PHP classes already included in minify?
I think you have two main options really.
Use cURL to call the google code minifier. http://php.net/manual/en/book.curl.php
Use a different minifier that you can run locally. Try:
http://developer.yahoo.com/yui/compressor/ (Requires Java runtime)
http://www.crockford.com/javascript/jsmin.html (Windows only)
You can write a wrapper with CURL to send your files to the server, gets the returned text and outputs it to the client.
Beware, though, that it will slow down your server a lot (it will minify the code every time someone asks for it). So you would need a caching mechanism to do it only once.
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
A simple hello world NPAPI plugin for Google Chrome?
How to open a file which includes in Chrome extension by C/C++?
originally i wanted to develop a chrome extension to open a file on the user's pc.
I wanted to use php fopen some SO users said that I have to use NPAPI instead and said that this is a duplicate question and deleted my question.
I just want to know why can't I use fopen? And if i really don't have other options, then how to open a file using firebreath?
When i go to this section of the docs i don't see the snippets.
i know that moderators gonna come to my question saying that this is a dupe and link to this question I'm one step ahead lol
I don't understand a thing from the accepted answer and i don't understand what file he edited.
the second answer give this link but i can't see the snippets! can you?
I'm on linux mint 12, 32 bit
let me change the question. Can i do this in java? Flashgot got some jar files in the source code :)
install flashgot using chrome, a file called flashgot-1.3.9-tb+sm+fx.xpi will be downloaded, change that to flashgot-1.3.9-tb+sm+fx.zip unzip it and go to the chrome folder
Can i do it in python? every linux distro has python by default
I just want to know why can't I use fopen?
Because JavaScript isn't C.
More generally, there's no way for arbitrary web pages to run arbitrary native code on your computer because otherwise clicking a link could take you to a page that would steal every file on your computer and then erase your hard drive.
If you use firebreath then you're in C++, so you can use fopen if you wish. Keep in mind that you would have the same privileges as the browser, which running as a user probably can't write places like Program Files, etc.
You can't use fopen in javascript. I don't know why a "building firebreath on linux" page would ever have snippets on how to open a file; since firebreath is just C++ I don't know why we'd need to add docs for opening a file at all.. it's just C++. Open a file like you would in any other C++ application.
The other question has all the information you need to figure out where your file is; they didn't include specifics on how to do the operation itself because you don't need those specifics; you can get them anywhere. Try googling "open a file in c++" and you'll get lots of hits.