|
Posted by q on 11/01/05 17:54
"Phil Nospam" <philnospam@dontwantnospam.com> wrote in message
news:Bxy8f.20$0D4.15728@twister.southeast.rr.com...
> "J.O. Aho" <user@example.net> wrote in message
> news:3sfe4kFnto1oU1@individual.net...
> > Phil Nospam wrote:
> >
> >
> > > 2) If my databases will have some fields containing URLs to pages on
my
> site
> > > and other URLs to other web sites, what kind of problems will I face
> when I
> > > try to update the production DB with what I've developed on the
> development
> > > DB?
> >
> > Don't use hard coded URLs, you let the php script to "ask" the web
server
> what
> > ip-name it uses and then just hard code the path.
> >
> > $mainpage=$_SERVER['SERVER_NAME']."/index.php";
> >
> >
> > //Aho
>
> Thanks Aho.
>
> I thought that having it at home would be better but was concerned about
> errors that would occur after uploading when the paths/server names might
> not match up exactly. Your explanation above is most helpful. As you
might
> be able to tell, I'm not a DBA and have never taken any courses (not even
> for the Brio/Oracle stuff I did). I just tend to be thrust into things at
> work because they see I have good general computer knowledge and can learn
> new skills/concepts very quickly.
>
> One more thing about your response above. Let's assume that I register
the
> domain www.mywebsite.com. Would that line look like this:
>
> $mainpage=$_SERVER['www.mywebsite.com']."/index.php";
>
> I'm picking up a used PC on Monday from a state government surplus
warehouse
> to use as my development PC/Server at home. 900MHz Pentium3 with 512MB
> RAM, 40GB HD, CD burner, ZIP drive, two NICs, dual VGA output video card,
> and I think there was an internal tape backup - very sweet for $50. As
much
> as possible I'm going to try and install the same versions of
> Linux/Apache/mySql and other software as the host I choose. When I set
this
> up, will I then adjust the line above to read:
>
> $mainpage=$_SERVER['my_development_server_name']."/index.php";
>
> Thanks again for your help...
>
> Phil
>
>
>
Hi Phil,
Adding to what Ado said, the php code $_SERVER['SERVER_NAME'] allows you to
define 'SERVER_NAME' = 'my_development_server_name' in a config file, so you
only have to type this once. This is what makes php transportable, since the
config file is the only one you need to change when moving from server to
server. Similarly, the location of your mySql server and connection details
are defined just once. Everything flows on from there, since folder names
refer to the server, and file names to the folder etc.
Like you, I decided to develop my own php site armed with a fair bit of
expertise with HTML and databases, and one year later I'm still at it! My
site is very complex, with 800 pages, but I'm only customising proprietary
software, and it's been the steepest learning curve I've ever been on.
I strongly recommend you seek out some online tutorials before you begin,
firstly on installing and configuring Linux/Apache/mySql and php, which is
no mean feat, then on building a website with php and mySql. There are lots
of good ones around, and they will save weeks, maybe months of frustration.
Bear in mind it's all OpenSource, so although there are manuals, they're not
written with customer service in mind. Nor are there any simple editing
tools for these programs as there are for HTML, and just to make things
really difficult, it's not possible to see the source code of web pages
you'd like to emulate. I mistakenly thought it would be like learning
Javascript, but after trawling through countless sites looking for code
snippets that either don't work or cost money, I think the best (only) place
to see examples of working scripts is at koders.com.
One final tip - try and choose a hosting service that can offer some support
with php code. I'm at quadrahosting.com and they've been brilliant.
Cheers,
Jem
[Back to original message]
|