How to run my PHP interpreter on network files

365 views Asked by At

Is there a way to have your PHP interpreter (I'm using WAMP) installed locally but have it run for files on the network? So I have...

  • C:\wamp\bin\php\phpx.x.xx\ (Local install)

and

  • Z:\www\example.com\index.php (Network)

How can I open index.php in the browser and have it run the interpreter? Of course, the way I currently run things is saving to C:\wamp\www\path\ and pull up http://localhost/path/index.php in the browser.


I'm wanting to avoid having to remote connect to my developer desktop to access local files there. I'd rather put my .php files on the network and work with them anywhere.

3

There are 3 answers

4
Robert On

Of course Quentin answer is good but I looked more into your problem and it's pretty typical.

You should consider using Control Version System like GIT and create Repository. Then put code there. Your developers will download it and run it on their own machines and you can check the files using for example GitLab or GitHub or any other service or even console.

In that configuration you can have:

  1. Production enviroment where project stays and works
  2. Stage - which is identical to production and you can check there changes before applying them in production
  3. Dev where your developers write code.
9
Quentin On

The browser cannot involve the PHP interpreter. It talks to a webserver, the webserver runs PHP.

You can configure Apache to use whatever directories you like with various directives such as

DocumentRoot "Z:/www/example.com"

or

Alias /foo "Z:/www/example.com"

For development purposes, you may just wish to run the built in webserver on whatever machine you are working on:

php -S localhost:8000
0
hakki On

Wamp uses Apache as web server and this web server has virtual host by default. If you add new virtual host for network it will work.

Also you can add alias to your Apache config