0

I have been using "Delphi PHP XE2". The file structure has worked fine for over a year on the development machine and the production.

The folders are organised as follows.

src/app_login.php
src/add
src/css
src/js
src/fnc
src/db
src/images

etc.

I am just trying out PHPSTORM. The include files work fine. When I run it in Firefox it can find all images, JavaScript files, etc. But it can not find the CSS files as it is looking for them in

css

rather than

src/css

I haven't changed anything.

  1. Why is the browser now looking at absolute path rather than relative?
  2. How did PHPStorm manage to tell it that?
  3. And how do I coerce it to treat them as relative paths?

I see that in the browser it runs it as:

http://localhost:63342/SRC/app_login.php

instead of

http://localhost:63342/app_login.php

I guess this the problem. How do I coerce it to move down one directory level?

I am trying to set up IIS, I think this might be best for later on. Here are the screen shots:

Iss Bindings

Iss Settings

I configured the hosts file so that when I type wys.com in the browser it tries to run it and shows a blank page. If I type in 192.168.1.0 it just shows a blank page. View Source shows nothing. I was expecting it to run the index.html at d:\wys\src. Why is the browser not running it?

2
  • Please not that now (after you added IIS info) your question has little to do with PhpStorm (except, maybe, deployment (so that it opens files in browser using that domain name)) Commented May 6, 2015 at 23:04
  • I realise that, I wanted to get it working in the browser then try to it in phpstorm Commented May 6, 2015 at 23:29

1 Answer 1

2

You are using PhpStorm's own simple built-in web server which uses URLs like http://localhost:63342/ProjectName/app_login.php. You cannot make http://localhost:63342/app_login.php using such server as it will not be able to tell what files to serve.

Either use your own Apache/IIS/whatever web server .. or the best you can get with built-in server would be http://ProjectName:63342/app_login.php(IDE needs to know what site/files to serve somehow). For that:

  1. Edit your hosts file (or local DNS server, if preferred and have one) and point ProjectName to your computer's IP (e.g. 127.0.0.1).

  2. Create Deployment entry of correct type (In Place should do), configure it (provide desired URL etc -- http://ProjectName:63342/) and mark it as Default for this project -- now IDE will use URL from there when generating "open in browser" URLs.

Sign up to request clarification or add additional context in comments.

6 Comments

It all worked with the previous IDE. I cant see why they would make it so that the it is hard to match the development file structure with the production. Anyway, I didn't get far with IIS. SO I was trying the hosts file. By projectname do you mean a url or do you mean the path to the src
I have done steps 1 and 2 and the browser says the right thing on url box. But it gives a 404. I understand why, it doesnt know which drive/directory to start in
"It all worked with the previous IDE." I have a news for you -- PhpStorm is different IDE. In this particular case you are using PhpStorm's own server .. which has certain rules on how it works (it can serve all projects on the same port).
"By projectname do you mean a url or do you mean the path to the src" ProjectName means project name -- not ProjectPath or anything else. In your particular (based on http://localhost:63342/SRC/app_login.php URL) case it appears to be SRC
"it doesnt know which drive/directory to start in" Please explain. If you done all steps correctly, then IDE already knows where to find your files.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.