Can PHP pages be run locally? [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
Can PHP pages be run locally?
I am trying several demos on creating a contact form, at the moment I am trying this one:
http://www.html-form-guide.com/contact-form/php-email-contact-form.html
I have downloaded the source files and put my own email address in, but when I click submit I get directed to the PHP page. The form's action attribute is set to that PHP page, so I was wondering if it is because PHP is not able to run locally? If I want the form to submit and send to my email would I need to put the downloaded source pages online to make them work?
This is not the only tutorial I've used where this happens.
Sorry if this is a silly question - newbie web developer :).
Thanks.

PHP, in this context, is a server side language. It must be run by a webserver.
The webserver can be installed and run locally.

PHP needs to be executed server-side, which means you will need to set up a local webserver.
The best way to go would be taking a look at WAMP or MAMP or LAMP, depending on your operating system.

You need to be running a PHP server locally, and have the file "hosted" by the server (in the same folder, but usually /var/www/). There are a verity of free programs for this. I like WAMP ( http://sourceforge.net/projects/wampserver/)

You should simple install WAMP server. If you use Windows I recommend this one: http://www.easyphp.org/
When you install it you should copy php file to projects directory and then you can run in your browser http://localhost/projects/ to see your file and to execute it

Related

How to change a webpage from .html to .php [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I have made a webpage using .html and I would now like to change it to .php so I can connect it to a database. I have changed the file extension to .php but now it just opens the actual code in the browser as opposed to opening the website. I have googled it but all I can find is stuff about installing .php on a server, when I am just trying to open the file on my device. I am using Microsoft Edge if that matters. What do I do?
First of all, what you have to understand is php is a server side language whereas html is a client side language. As you might already know, html can be directly interpreted by browser but for php, the case is different. You need to have a server installed.
Moving on to your question How to change html to php!!, it's simple, just change the extension of the file.
To run the file, use local server. There are many options you can choose from. Personally I find Xampp easy to setup for beginner. It's my personal opinion though.
To sum up, to change html from php, install a localhost or local server to your computer, migrate your files to server's run directory. You can find plenty of tutorials on setting up localhost.
If you want to run a PHP file after changing its extension. You need to install xammp or lamp server. In the localhost server, you can view your PHP pages on any browser.

How do I utilize PHP on my Windows 7 computer? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I'm trying to create a website with Dreamweaver CS6, which I am doing just fine. On one of my pages, I want the visitor to be able to send me an email. I'm under the impression that I need a web server and PHP installed. Here's what I have tried:
Installed WAMP but couldn't get it to send the email. The errors indicated it didn't recognize PHP
Installed XAMPP. I got a little closer with this one but no luck
Installed Apache web server separately and got it configured. Installed PHP separately and seem to have it configured properly as I can see the PHPInfo page
I am running Windows 7 Ultimate 64bit / Apache 2.2.4 / PHP 5.2.6 (I have these older versions of Apache and PHP because I was following a tutorial and wanted to make sure I could get through it. I've tried downloading several free PHP mail forms to incorporate into this one page, contact.html but I can't get any of them to work. If there is some other way to achieve this I haven't been able to find it and everything I have read indicates you cannot do it with just HTML.
If there is anyone willing to take me through this step-by-step, it would be greatly appreciated.
Php needs to use smtp to send mail on windows. See a previous question here
Apologies as I realise this should be a comment but my rep does not allow me to.

Steps to develop a website to upload files [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am planning to develop a webpage where anyone can upload a file. I want to do this because I want to make a webpage where my friends can upload a file, if they think that that file will help others (eg: a free tutorial pdf on Unix).
To develop and test this webpage what is needed ? As far as I think now:
Webserver ? I tried installing apache2 but had some issues
mysql-server ? I installed mysql-server ,but have issues with creating user for db
php
What else would I need ? (Assuming 'download' functionality will be added later, NOT NOW)
I am developing this in Ubuntu 12.04
Thanks
You don't need MySQL for the problem as described. All that would be required is a web server with a working PHP install. You can see the PHP documentation for how to handle the file uploads.
once you have installed and configured wamp/lamp.
platform(window, linux) doesnt matter a web application is not platform dependent. wamp/lamp will install mysql(database server), and apache(web server). thirdly determine you web scripting language(php, jsp, asp ect).if php, your php scripts must be executed by the web server ie you have to place them under c:\wamp\www\sitefolder\
How to: http://www.w3schools.com/php/php_file_upload.asp
you can test if on your local machine
then with Apache running, type in your browser www.localhost\sitefolder\yourscipt.php.
assuming you have an active domain and hosting account you may need to consider the
::::
-determine the upload size limit, location, and file type on the php
-you may require/though not a must client side scriptiing jquery- ajax for asynchronous requests.
-security will be of concern, you dont want some harmful data scripts on your site.
verify upload limit with your hosing provider..

No idea what to do with a pure php page [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am trying to implement an already coded image upload system which has been written purely in php. I have a html website but did not know that I could direct users to a pure php page. Surely it would just show in a browser as coding. How do I make this pure php webpage into a html webpage? I am new to web design so any help is muchly appreciated.
Would I have to implement it as an iframe within a html page?
Thanks
The output of the PHP program just needs to be an HTML document (unless you override it, it will output a text/html content-type so you only have to provide the HTML document itself).
There is no need to involve iframes.
Surely it would just show in a browser as coding.
No, unless you are using a server which does not support PHP or have not configured it correctly, the PHP will be executed on the server and the output delivered to the browser.
Install PHP with Apache. If you are feeling tough to install it manual, go to www.apachefriends.org, find the suitable version of XAMPP for you, download and install in in your machine.
Make sure you install the Apache service. This will make Apache to run whenever you boot your system.
Move your PHP, HTML and all associated CSS, JS files to the following folder path, C:\xampp\htdocs\YOUR_FOLDER_NAME
In your browser, you can open the files as http://localhost/YOUR_FOLDER_NAME/FILENAME.php.
Now you will see it as processed HTML page. This will work for both your HTML and PHP pages.

Is it possible to run internal application xx.exe on click of a link [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
In my project simply I want to run local application as netbeans or word document installed in my computer on click of a link? Is it possible ? If yes how am I to do it? If no why it's not possible.
Thanks in advance.
You can link to a PHP script and then in this script use exec() to run your application.
<?php
exec('path/to/your/app.exe -possibleparam -param2');
/* EOF */
I don't know if it is that what you are looking for:
http://www.php.net/manual/en/function.exec.php
exec will execute the app in the machine where the php is installed (so your server).
If you mean that the php should open an app on the user pc while he's surfing on your site, no.
The only way to to this is an NPAPI plugin. And use Javascript, not PHP.
PHP runs on the server. It has no control over the client. This is by design. If web pages could run programs on the client computer then it would be abused to an unlimited degree, for spam, viruses, and junk.
You can use the exec function to run a program on the server. If your server and client happen to be running on the same local computer, then this will do what you want.

Categories