Beginner Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherBeginner Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 20th, 2001, 06:00 AM
Kaliban Kaliban is offline
Dreaming in Digital, but it's better than nothing.
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Location: Nottingham, UK
Posts: 26 Kaliban User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy PHP/MySQL/Apache

I got PHP MySQL and Apache all running on my local development machine, and have now written some useful code that runs fine locally. The problem is that now i have to make it work on the companies server, or my supervisor will look a bit dumb, as will I.

What i need help with is what to do to make php which is on the same server, talk to MySQL and fetch/write the data it needs to.
Could anyone give me idiot-proof help with making this work?

From looking at other posts and some literature i have made a guess that its to do with the part where i go:
"<?
mysql_connect ('localhost', 'user', 'password');
mysql_select_db (dbname);
"

But i'm not sure a: what to change the localhost to when its on the server. and b: if i need to make changes to any other files, especially server files.

Regards and thanks in advance.

Kaliban

Reply With Quote
  #2  
Old November 20th, 2001, 07:14 AM
Datamike's Avatar
Datamike Datamike is offline
Web Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Oct 2001
Location: Finland
Posts: 719 Datamike User rank is Corporal (100 - 500 Reputation Level)Datamike User rank is Corporal (100 - 500 Reputation Level)Datamike User rank is Corporal (100 - 500 Reputation Level)Datamike User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 11 h 27 m 33 sec
Reputation Power: 9
I suggest you get a book and read what it says about MySQL with PHP. Also, you can find good tutorials from the net, try phpBuilder or the PHP Manual.

You should not need to change the Localhost part to anything. When you use localhost, it means that you contact the server localy. If you specify something like http://www.server.com you contact it through the net, and that's now very wise.

I can't really tell about the other files, since I don't know what you have there. My advice is to contact your server administrator. He should know more about your database and what you need to change in your files.
__________________
-- Tomi Kaistila
-- Developer's Journal

The more you learn, the more you know.
The more you know, the more you forget.
The more you forget, the less you know.

Reply With Quote
  #3  
Old November 20th, 2001, 07:28 AM
realnowhereman realnowhereman is offline
Not there when you need me
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Oct 2001
Location: Berlin, Germany
Posts: 1,438 realnowhereman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 46 sec
Reputation Power: 8
It's rather simple:
1) Find the administrator.
2) Buy him a coffee so he will listen to you.
3) Ask if Apache is working on the server and where its www directory is. If he says Apache isn't installed/running, tell him to make it work.
4) Ask whether PHP is enabled. If he says "no", ask him to install/enable it.
5) Repeat step 4 with MySQL.
6) Ask him for the server IP adress or hostname. Replace localhost in your code by his answer.
7) Ask him to create a MySQL account for you and put the username and the password into your script.
8) Upload/copy your script to Apache#s www directory on the server.
9) Debug (have fun).

If your admin says he can't do one of the things you ask him to do, tell him to think about a new job.

Btw: Devshed has also got a vers good PHP/MySQL tutorial:
http://www.devshed.com/Server_Side/PHP/PHP101
Part 4 describes database access.

Reply With Quote
  #4  
Old November 20th, 2001, 08:20 AM
Kaliban Kaliban is offline
Dreaming in Digital, but it's better than nothing.
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Location: Nottingham, UK
Posts: 26 Kaliban User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
It's a virtual server, the staff are blatantly unhelpful and my supervisor knows less about apache, php and mysql than i do, i've looked at tutorials and they arent much help right now because i don't know the first thing about server administration.

Sorry to cause inconvenience and thanks again.

Reply With Quote
  #5  
Old November 20th, 2001, 09:10 AM
realnowhereman realnowhereman is offline
Not there when you need me
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Oct 2001
Location: Berlin, Germany
Posts: 1,438 realnowhereman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 46 sec
Reputation Power: 8
1) Getting your files to Apache
The main thing is to to be able to get your files onto the server and into the www directory. If you can't, ask your admin to do that for you. Once you have done that, everything else should be at least possible. Do you know what the server is called? You probably do: it's part of the url that you type to get its web pages. Try pinging it to be sure. Now replace localhost in your script by that name.

2) Database
You'll have to have an account for MySQL. That's a problem if no one will let you create one or do that themselves. Flame the ppl by email. If that doesn't work, write a report and mail it to your boss, because it will be impossible for you to do your job.
Sorry about that, then.

Alternative:
Do you shut down your PC over night? If you don't, you can simply host the stuff on your machine. That probably means that others will have to access the files via IP adress, but it will work.

Reply With Quote
  #6  
Old November 20th, 2001, 05:39 PM
AlCapone's Avatar
AlCapone AlCapone is offline
Mobbing Gangster
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: Sep 2001
Location: "Best City" 2002 and 2003- Melbourne, Australia
Posts: 4,913 AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level)AlCapone User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 h 36 m 31 sec
Reputation Power: 17
Send a message via ICQ to AlCapone Send a message via AIM to AlCapone Send a message via Yahoo to AlCapone
>>Do you shut down your PC over night? If you don't, you can
>>simply host the stuff on your machine. That probably means
>>that others will have to access the files via IP adress, but it will work.
Thats what I do for fun but all it takes is to register domain with www.godaddy.com for some $8/year so... question is in speed though
__________________
And you know I mean that.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherBeginner Programming > PHP/MySQL/Apache


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway