Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #10690

Re: Learing PHP, Javascript, and Python on the Cheap, Help!

From Jerry Stuckle <jstucklex@attglobal.net>
Newsgroups comp.lang.php
Subject Re: Learing PHP, Javascript, and Python on the Cheap, Help!
Date 2013-08-31 16:21 -0400
Organization A noiseless patient Spider
Message-ID <kvtj7o$a7a$1@dont-email.me> (permalink)
References <cc0fae27-a20e-4f83-a5c8-1b5ad08a7c8b@googlegroups.com>

Show all headers | View raw


On 8/31/2013 11:52 AM, irishhacker@gmail.com wrote:
> I want to practice Javascript/HTML/CSS and the server side (PHP & Python) on the cheap, which means I want both the client and the server to be on the same hard drive. (My setup is Ubuntu Linux). I'm not sure what is already installed (Python and Perl was installed with the Ubuntu.)
> How do people usually do that? And once they do that, later on, how difficult is it to transition where the server code (PHP/Python) is on a remote server? I'm hoping that the transition from hard drive to remote server would involve 99.9% of the PHP/Python code still working.
>
> Obviously, that setup makes it difficult to test for Internet Explorer special annoyances and for high-level performance testing, and I'll live with that.
>
> Thank you.
>

Not hard at all.  J.O. gave you the instructions to install the required 
packages.  From there on, careful programming and attention to the 
settings should allow your code to transfer to a hosting company with 
very few changes.

You will probably want to add your own VirtualHost to your Apache 
configuration; there is a default one but you'll probably want your own 
options.  I suggest you start with the default one, but read up on 
VirtualHost and the various options in the Apache configuration (the 
folks in alt.apache.configuration can help you here).

You can access the server locally via http://127.0.0.1 for the default. 
  If you want your own server name for testing (i.e. example.com), you 
can set a VirtualHost for it in the Apache configuration and add an 
entry to your /etc/hosts file for the name, pointing it at 127.0.0.1 
(you will also need this if you use the non-default VirtualHost in the 
Apache configuration).

Some things to keep in mind:

1. Ensure you have the same PHP settings as the server, as others have 
indicated (or at least have compatible settings).  There are multiple 
hosting companies out there; if you find one which is incompatible, look 
for another one.  I've found usually the default options set by Debian 
work well; since Ubuntu is based off of Debian I would think the options 
are similar (or identical).

2. Don't hard code the server name in your scripts.  If you need to use 
the server name (most of the time you don't), use $_SERVER['SERVER_NAME'].

3. All file system paths in your scripts should be relative to 
$_SERVER['DOCUMENT_ROOT'].  Don't code any absolute paths in your scripts.

4. Put anything else system specific - i.e. database names and 
passwords, in a configuration file (i.e. config.php).  These will have 
to change when you go to a hosting service, so keep them together.  And 
put this file (and any other information you want to keep private) out 
of reach of the web - this is usually one level above the DOCUMENT_ROOT.

You will be able to get a good idea (but not perfect, obviously) if your 
scripts will work by just moving everything to a new directory hierarchy 
and changing the VirtualHost entry (including the server name) and 
updating your /etc/hosts file.

I do a lot of development on my local systems here, then upload the 
files to the server.  Other than the items in #4 above, everything 
transfers and runs with no changes.  But if I'm working on a client's 
files, I ensure my test system has the same options as the client's 
hosting company.

I probably forgot something, but can't think of what it might be right now.

Hope this helps some.

-- 
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Learing PHP, Javascript, and Python on the Cheap, Help! irishhacker@gmail.com - 2013-08-31 08:52 -0700
  Re: Learing PHP, Javascript, and Python on the Cheap, Help! Fiver <numeralfive@gmail.com> - 2013-08-31 18:36 +0200
  Re: Learing PHP, Javascript, and Python on the Cheap, Help! "J.O. Aho" <user@example.net> - 2013-08-31 18:37 +0200
    Re: Learing PHP, Javascript, and Python on the Cheap, Help! Twayne <nobody@spamcop.net> - 2013-08-31 14:57 -0400
      Re: Learing PHP, Javascript, and Python on the Cheap, Help! Jimmy Brubaker <jimb21@owandslow.com> - 2013-09-18 18:46 +0000
    Re: Learing PHP, Javascript, and Python on the Cheap, Help! The Natural Philosopher <tnp@invalid.invalid> - 2013-08-31 20:01 +0100
  Re: Learing PHP, Javascript, and Python on the Cheap, Help! The Natural Philosopher <tnp@invalid.invalid> - 2013-08-31 19:57 +0100
  Re: Learing PHP, Javascript, and Python on the Cheap, Help! Twayne <nobody@spamcop.net> - 2013-08-31 15:31 -0400
  Re: Learing PHP, Javascript, and Python on the Cheap, Help! Jerry Stuckle <jstucklex@attglobal.net> - 2013-08-31 16:21 -0400

csiph-web