Newb: Can I use multiple folders structure for multiple projects, nice and easily under XAMPP?

I'm thinking about buying PhpStorm.
I'm an old style professional developer, I use an IDE all day.

BUT I have a nice simple folder structure for my projects on my local PC.
1) I add a directory into the htdocs folder under XAMPP.
2) I edit an htaccess file for that directory and change a config file for root path and database and I'm away
- to move it all to a live server I just change the htaccess and config files.

I have up to 50 separate projects all ready to work on at any time. Some of the projects are fairly complex.

So I tried the PhpStorm demo and my method seemed hard to set up.
It wanted to force a project structure - so my stuff is all in it's project folder, but it seemd I had to define root each time and I couldn't get it to accept a sub folder.

Am I just going to find PhpStorm a big hassle?
I have tried  NetBeans and didn't like it - I currently use PHP Designer but it is missing some features.

Thanks

12 comments
Comment actions Permalink

Not certain if xampp did the same thing as wamp, but in version 2.5 there was a change.  You need to lookup into setting up virtual hosts for what you want.

If you do have the same situation you can try to revert it to the pre-2.5 way or try using virtualbox with vagrant within phpstorm/webstorm..

Here is some notes I have on how I did it in wamp.


Revert WAMPServer 2.5 "Your Projects" links to pre 2.5 mechanism



1 - Edit wamp/wampmanager.conf

In the section [main] add this line :

suppressLocalhost = "no"

Save the file

If this is set to "no" Your Project links will be in the form `localhost/folder_name` i.e. the pre WAMPServer 2.5 way.
If this is set to "yes" Your Project links will be in the form `folder_name` and require a Virtual Hosts definitions to work.



2a - Edit \wamp\www\index.php

Locate this line

$suppress_localhost = true;


and comment it out like so:

//$suppress_localhost = true;


2b - Find this line

$wampserverVersion = str_replace('"','',$result[1]); ajouter/add

and after that line add this code

//[modif oto] - On récupère la valeur de suppressLocalhost
preg_match('|suppressLocalhost = "(.*)"|',$wampConfFileContents,$result);
if($result[1] != "yes" )
    $suppress_localhost = false;
else
    $suppress_localhost = true;


Save this file


3 - Edit /wamp/scripts/config.inc.php
Find this line

$c_editor = $wampConf['editor']; ajouter/add :


and after that line add

//[modif oto] Ajout variable suppressLocalhost
if($wampConf['suppressLocalhost'] != "yes" )
    $c_suppressLocalhost = false;
else
    $c_suppressLocalhost = true;


Save the file



4 - Edit /wamp/scripts/refresh.php
Find this line

        {
            $myreplacesubmenuProjects .= 'Type: item; Caption: "'.$projectContents[$i].'"; Action: run; FileName: "'.$c_navigator.'"; Parameters: "['.$projectContents][$i].'/"; Glyph: 5


and REPLACE it with

        { //[modif oto] Support de suppressLocalhost dans wampmanager.conf
            $myreplacesubmenuProjects .= 'Type: item; Caption: "'.$projectContents[$i].'"; Action: run; FileName: "'.$c_navigator.'"; Parameters: "'.($c_suppressLocalhost ? "[" : 'http://localhost/').$projectContents[$i].'/"; Glyph: 5


Save this file.


The changes are now complete.

Now restart WAMPServer

0
Comment actions Permalink

That's useful to know Wayne - thanks.
I won't use virtual hosts - it drives me mad!

But it's not that XAMPP was making my use of PHPStorm difficult - it was PHPStorm requiring the virtual hosts structure.. or am I wrong there?

0
Comment actions Permalink

Are you talking about deployment or something else here?

0
Comment actions Permalink

I'm simply talking about having lots of separate projects each under its own folder in my htdocs directory.
This is for dev work on my PC - not proper hosting
They don't share any resources.

a) can I do this easily with PhpStorm?
b) I don't want to have to  mess around with virtual hosts each time I add a new project

0
Comment actions Permalink

That is an XAMMP question not a phpstorm question.  I gave you the wamp answer for that.

0
Comment actions Permalink

No it's NOT an XAMPP question - I already run my local machine with XAMPP

READ MY ORIGINAL QUESTION !

This is what I asked:
- - -
I have a nice simple folder structure for my projects on my local PC.
1) I add a directory into the htdocs folder under XAMPP.
2) I edit an htaccess file for that directory and change a config file for root path and database and I'm away
- to move it all to a live server I just change the htaccess and config files.

I have up to 50 separate projects all ready to work on at any time. Some of the projects are fairly complex.

So I tried the PhpStorm demo and my method seemed hard to set up.
It  wanted to force a project structure -
My stuff is all in it's  own project folder, but it seemed PHP Storm made me define root each time and I  couldn't get it to accept a sub folder.
- - -
AND
- - -
But it's not that XAMPP was making my use of PHPStorm difficult - it was  PHPStorm requiring the virtual hosts structure.. or am I wrong there?
- - -

If you don't know just say so

0
Comment actions Permalink

Hi there,

Sorry, but it's actually not clear what you have got there (folder structure inside the actual project) and what problems you have got there.

PHP Storm made me define root each time and I  couldn't get it to accept a sub folder.

What do you mean by this?

it was  PHPStorm requiring the virtual hosts structure.. or am I wrong there?

Not sure what you mean here.

I prefer (highly prefer) working with virtual hosts .. as in this case every project has its own domain name (faked via hosts file ... or via proper local DNS server) so I have project and URL structure behave just like it would on real server once deployed there.

Working with different projects when you have 1 common URL and access each project via subfolder --- not ideal (URL structure .. e.g. how do you deal with url rewrite; what if site has special requirements in modules -- some config instructions cannot be placed in .htaccess files .. only virtualhost section and above...)


In any case -- I do not see (with the amount of information you have provided so far) what kind of problem you are having here. Can you please take one sample project and illustrate it with some screenshots -- e.g. what URL you are using .. and what problem you do have with that setup in PhpStorm -- stuff like that.

0
Comment actions Permalink

OK thanks

Can I use phpStorm without Virtual Hosts?
I couldn't get it to work when I had multiple different folders, each for its own 'website' under my htdocs on my PC.
..I mean obviously it edited things no problem but I couldn't get multiple projects set up, with each knowing their own structure

.htdocs
>project a
    an .htaccess file sets its root
  > sub folders


>project b
     an .htaccess file sets root
  > sub folders


>project c
   an .htaccess file sets root
  > sub folders

and so on


Why would I want to use Virtual hosts, when I need to see the live website all the time, as well as my development work on my local PC, and my staging server.
It adds another layer of complication.

0
Comment actions Permalink

Let me try a work flow (this isn't the only way to do it) to see if you are doing something completely different.

I have a projects folder   C:\projects\nameofproject  for use with each project within PHPSTORM.   I can RUN/DEBUG in phpstorm to this folder.   After I am completely finished with the project I copy the files to C:\wamp\www\nameofproject where wamp is setup to operate.

If I have three different projects in phpstorm development I would have the following directories used by phpstorm:
     C:\projects\nameofproject01
     C:\projects\nameofproject02
     C:\projects\nameofproject03

When development is completed I will have copied the files from each project to their own wamp directory like this:
     C:\wamp\www\nameofproject01
     C:\wamp\www\nameofproject02
     C:\wamp\www\nameofproject03


Now this isn't the only way to do it.   Virtualbox and vagrant is a great (the best?!) option.



Are you trying to develop the code in phpstorm in the root of you xampp so you don't have to copy files?

Do you have phpstorm setup so you can run/debug without using xampp?

0
Comment actions Permalink

I'm not using XAMPP (but used vanilla Apache few years ago with Virtual Hosts -- back when I had Windows XP on my computers). Now I'm using IIS 7.5 that comes with my Windows 7 -- does the job fine, especially since around 80-85% of my projects would run on Windows platform anyway (PHP projects that have SQL Server as DB and bespoke windows app that works with it -- with such requirements it has to run on Windows).

My question is: why do you need your project files in 2 different locations?

1) Why don't you work with your projects directly from C:\wamp\www\nameofproject01 ? I mean -- create/open project from this location.

2) You can configure your Apache to serve your files directly from C:\projects\nameofproject01 . But yes -- you will have to use Virtual Hosts and separate (fake) domain name in such case.

3) In case if it has to be 2 separete locations -- you can:
  a) Use Deployment functionality to copy your project files to another location (can even be configure to be done automatically on save)
  b) Use a symlink C:\wamp\www\nameofproject01 --> C:\projects\nameofproject01 -- this way you will have single copy but at 2 different locations.

Are you trying to develop the code in phpstorm in the root of you xampp so you don't have to copy files?

As I have said -- I'm not using XAMPP ... but I use VirtualHosts equivalent in my IIS (every project is a separate site in IIS which is accessible via separate domain name)

This means:

D:\Projects\web
  \site1.com -- project root

     \app
     \config
     \web (website root here)
  \another-site.net -- project root

     \app
     \var
     \httpdocs (website root here)

  • site.com (real name) is accessible locally via site1.local.dev (domain name is faked via local hosts file).
  • Project root: D:\Projects\web\site.com
  • Website root: D:\Projects\web\site.com\web


I'm using IIS .. but exactly the same can be done with Apache. Since web server is started together with my computer .. it's always available when I need it.

With such setup I have no need to copy my files anywhere -- web server serves my files directly from project location. Obviously, it's a very simple setup and may not be suitable if you need some advanced stuff (e.g. dev code structure differs from production; dev environment is completely different; multiple branches fo the same code at the same time etc) -- for that VM is the way to go for sure.

Do you have phpstorm setup so you can run/debug without using xampp?

Not sure what you mean here. I use IIS to serve my website (an not PHP's own web server -- e.g. like Symfony/Laravel usually does). At the end of the day project will be run on proper web server once deployed ... and I do have local web server already .. so why not to use it (be it IIS .. or Apache in your case).

Debugging is nice and easy (at least for me/my setup .. plus I know how debugging works in general (e.g. how to deal with symlinks/unhittable breakpoints etc) so it's not a problem for me). If it's a web project then I (initiate) debug it via browser (I'm using browser extension to set/remove xdebug cookie).

Now this isn't the only way to do it.   Virtualbox and vagrant is a great (the best?!) option.

You code locally and use Deployment functionality to copy your files to VM/another server when needed. Now your code is executed remotely .. so debugging may be slightly different (different requirements to pass/establish debug connection; path mappings to tell IDE what remote path correcsponds to local project one) .. but that's about it (generally speaking) -- code executed on remote/virtual server but actual debugging interface is local.

0
Comment actions Permalink

@andriy, do it what ever way you want.  I was trying to figure out what the OP was doing. So you are kind of sidetracking it imo.

It doesn't make sense to work in wamp area to me.  You like it, fine you do it that way.    Your way it is like mixing dev code and production code together, but fine if you like it that way.  What if you start working branches?  Now that is there too.  seems odd to me.

0
Comment actions Permalink

Yes I use one location.
Madness to use two - we're talking about my local PC where I develop

I have a webserver location out on the real internet for any final tweaks

I want to do my PHP and JS and HTML in one place - I have to test in different browsers.
I don't really need much PHP debugging as I am experienced and use print_r when I need to.
I find I spend longer in the HTML part (which I don't enjoy..)
I'm looking for great code completion, better JS debugging, a little Xdebug, live definitions on my code functions.

TBH I'm not that bothered about integrated FTP or Versioning - I like Filezilla being outside, it's not a time waster.
I use Tortoise SVN so maybe a built in tool would work faster..

So I'm with Andriy - though I'm not going to go near IIS  -  but the fewer new tools I need to learn the better.

0

Please sign in to leave a comment.