Forum Moderators: bakedjake

Message Too Old, No Replies

First time setting Linux system for development of PHP

         

complete

4:27 pm on Jan 2, 2017 (gmt 0)

10+ Year Member Top Contributors Of The Month



Hello group.  I already have a php web site set up and hosted by an internet service provider.  I FTP all the files over the internet to the site.  I have found that the only way to debut it is to set up a local version of it with my own Operating Server.  I assume that this is the case, anyway.

I also assume that I should use a Linux distribution in order to do this properly.  I have a Linux machine already.  So I guess this will do.

Can anyone suggest a way to get started with this?

not2easy

9:00 pm on Jan 2, 2017 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



You should be able to find free LAMP packages to get started with. I know there are WAMP and MAMP packages for Windows and Mac. This is usually a zipped set of Apache, MySql and PHP. Installation is simple and settings are yours to adjust.

phranque

12:33 am on Jan 3, 2017 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



i would suggest setting up your staging server under a different subdomain (e.g. staging.example.com vs www.example.com) using the same hosting/isp environment.
make sure the staging server is protected from crawlers by using HTTP Basic Authentication or some equivalent.

Authentication and Authorization - Apache HTTP Server Version 2.4:
https://httpd.apache.org/docs/current/howto/auth.html [httpd.apache.org]

billzo

4:05 am on Jan 3, 2017 (gmt 0)

5+ Year Member




I also assume that I should use a Linux distribution in order to do this properly. I have a Linux machine already. So I guess this will do.

Can anyone suggest a way to get started with this?


Since you already have a Linux machine, you could go with that and install PHP/MySQL/phpMyAdmin or a LAMP package (I assume the machine already has Apache installed by default). There are a few issues there that I will not muddy the waters with now. I am assuming you know how to do the networking to the Linux machine.

You could also download a package like XAMPP and install that and have a reasonable facsimile of a PHP-Apache setup. Or, you could download a virtualization package like VirtualBox, install Linux and PHP on it, and have everything on the same computer with a more genuine Linux setup than XAMPP may allow. (Not something most people will need to be concerned with.)


i would suggest setting up your staging server under a different subdomain (e.g. staging.example.com vs www.example.com) using the same hosting/isp environment.


That is another possibility. However, with things like Wordpress or anything that has URLs hard coded, using a subdomain is a pain in the butt later. You can use your computer's hosts file to resolve the DNS to your development machine and just use your regular domain name in the web server's virtual hosts file.

I have found that when doing development that mimicking the setup of your production machine is best. That is, making sure the PHP and Apache version you are developing on is the same as your production web server and also using the main domain. That way, the final testing and debugging is minimal.

It all depends on which way the original poster wants to go. I like to keep everything on the same machine as I find it easiest.

graeme_p

6:23 am on Jan 3, 2017 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I would suggest that should not use things like XAMPP. They make it easier to install a LAMP stack on OSes where software installation is hard. On Linux software installation is easy. You do not say what distribution you use, but on Ubuntu it is as easy as typing this in:


sudo apt-get install lamp-server^


or you can install Apache, PHP and MySQL from a GUI package manager on a local machine (Software Centre in Ubuntu).

see: [help.ubuntu.com ]

You will have to do some configuration, but there is really no escaping that.

Jonesy

7:16 pm on Jan 15, 2017 (gmt 0)

10+ Year Member Top Contributors Of The Month



For local development and testing I use a "local" domain.
If your live web site is at example.com, define a "local" domain in /etc/hosts
thus:
 127.0.0.1 www.example.tst example.tst

I even have shared hosting set up on my local server, and have several
"domains.tst" defined in /etc/hosts and apache.

Do try to keep your local sever environment 'close' to that provided by your web host.