FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Learing PHP, Javascript, and Python on the Cheap, Help!
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: Learing PHP, Javascript, and Python on the Cheap, Help! [message #182736 is a reply to message #182724] Sat, 31 August 2013 20:21 Go to previous message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma:
Senior Member
On 8/31/2013 11:52 AM, irishhacker(at)gmail(dot)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(at)attglobal(dot)net
==================
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Browser fingerprinting?
Next Topic: Lightweight MVC framework
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 03:51:18 GMT 2024

Total time taken to generate the page: 0.03995 seconds