NickF
NickF

Reputation: 5737

PhpStorm run file in browser

I'm using PhpStorm and WAMP.

My project location is: C:\!Dev_Web\PHP\PHP_test where I have a file test1.php

<!DOCTYPE html>
<html>
<body>

<?php
echo "My first PHP script!";
?>

</body>
</html>

The wamp location is: C:\wamp (port 80)

When I run the file I see the results in run window.

How to display the results in browser?

Upvotes: 1

Views: 4148

Answers (5)

zergussino
zergussino

Reputation: 821

You can setup deployment to local folder and this will be simply a matter of saving the file.

Steps: 1) In PhpStorm open Tools -> Deployment -> Tick Automatic Upload (always). This way your file will be copied to desired directory every time you save the file.

2) Tools -> Deployment -> Configuration

3) in the window opened click + button and, enter any name, f.e. 'Test Folder' and in the dropdown Type select Local or mounted folder

4) After that click select folder C:\wamp in the Folder field on the right side and enter server address.

5) on the tab Mappings in the right section enter Deployment path on server as \ or select whatever path you want relative to c:\wamp. Your edited file will be copied there upon save.

6) On the left side tick button Use Default (4th next to + button)

7) Click Ok. That's it.

Now, you don't have to copy file manually each time. Just edit, save and it will be copied automatically. If you want to copy it manually with keyboard shortcut - just set shortcut for action Upload to Default Server (I personally set it to Ctrl+Alt+U) and untick Automatic Upload.

Upvotes: 2

Dave
Dave

Reputation: 76

Yes as Jonathan Felipe da Rosa said you need to copy the files to wamp WWW, from this you should be able to right click on the wamp icon in your task bar and select localhost.

Upvotes: 0

you may copy your files to the directory C:\wamp\www**, and to acess your project in your browser acess the page **localhost/projectfilename/test1.php

Upvotes: 2

Himanshu Bhardiya
Himanshu Bhardiya

Reputation: 1057

you need to run your file from URL, not from PhpStorm. like: "localhost\module\file.php" otherwise you need to setup on PhpStorm

Upvotes: 0

rray
rray

Reputation: 2556

right click on file, open file 'file name' on local or direct by browser http://localhost/projectname/filename.php

Upvotes: 0

Related Questions