|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
||||
|
||||
|
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. |
|
#3
|
|||
|
|||
|
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.
__________________
PHP manual | MySQL manual | Apache docs | Linux Documentation Project | Free Software Foundation Smart Questions HOWTO | PHP security | PHP FAQ | Posting HOWTO Wikipedia | English dictionary | Google | News | RFCs Thus Spoke Zarathustra | A Skeptic's Guide to Christianity | Project Gutenberg | Skeptic's Annotated Bible ParEcon | Marxists Internet Archive | The Memory Hole | Landover Baptist | DHMO Research Universal Declaration of Human Rights | UN Charter | Geneva Conventions Sinfest | Chopping Block | Filthy Lies | Bob the Angry Flower | How to Shoot Yourself In the Foot |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
|||
|
|||
|
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. |
|
#6
|
||||
|
||||
|
>>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. |
![]() |
| Viewing: Dev Shed Forums > Other > Beginner Programming > PHP/MySQL/Apache |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|