Copy link to clipboard
Copied
I am new to to PHP. I'm bound and determined to create a PHP site for a mySQL database (I was able to create 700 record database site in MAMP -- yay!! One step closer!!!). Now I want to set up a test page, to help me learn dynamic pages and accessing my database. I want to test the pages locally, and am not sure I set up the new site correctly.
I'm on a Macbook Pro, using CS4. System 10.6
Here's how I filled out the site definitions:
- Name: test
- HTTP Address: http://mysite.com/public_html (of course, I used my actual domain URL instead of mysite)
- server tech: Yes, PHP mySQL
- edit and test locally (MAMP is installed and working, so I'm thinking this is the right choice)
- Where to store files: I browsed to the location where I want to store this test.
/Users/myname/Desktop/database/public_html/
- What URL used to browse to root: http://localhost/public_html
When I hit "test" I get...
ERROR: DW can not use the prefix you entered to display live data. I clicked on "Help" but I was unable to resolve the issue...
Also, the "+" sign is grayed out in Databases, so I'm thinking this has something to do with the site definitions I used.
THANKS! The journey of a thousand miles begins with one step...
I'm glad you finally got there in the end. If you're looking for tutorials, you might like to try this three-part tutorial that I wrote for Adobe: Build your first dynamic website with PHP. It starts quite simply, but gets progressively more advanced, so take it slowly.
You might also be interested in some of the books I have written. See my website, http://foundationphp.com/ for details. Since, you're using Dreamweaver CS4, The Essential Guide to Dreamweaver CS4 with CSS, Ajax, and PHP, is proba
...Copy link to clipboard
Copied
Did some more poking around on the web. Found a different tutorial that leads me to believe I should change "Where do I want to store" info to:
/Applications/MAMP/htdocs/projectfoldername.
I also changed
- What URL used to browse to root: http://localhost/projectfoldername
But I'm still not getting the url test to work.
Copy link to clipboard
Copied
The files must be stored in the server's document root (or a subfolder thereof). In the case of MAMP, this is /Applications/MAMP/htdocs or a subfolder of htdocs. Your revised setup looks correct, but check the details here:
http://www.adobe.com/devnet/dreamweaver/articles/setup_php.html#articlecontentAdobe_numberedheader_2
The screenshots show the location of htdocs on Windows. Otherwise, the setup procedure is identical. Make sure that the Apache and MySQL servers are running.
Copy link to clipboard
Copied
David:
Thank you so much for coming to help me AGAIN! And for being so speedy!!!
The wording appears to be different between Mac and Windows (and where/how you enter info in the define site dialog boxes.) So I'm not sure I'm setting it up as they instruct. Sorry to get SO BASIC about all this but I'd love to get this working.
#3: I'm assuming "Local Site folder" in the Tutorial is the same as "Local Root folder" on Mac.
I selected /Applications/MAMP/htdocs/cabintest (cabintest is a folder I created inside "htdocs" to hold the website)
My windows look very different, and uses different wording. I think I have it set up comparable to the tutorial link you set, but since I'm such a novice, I wanted to verify.
Under the advanced tab of "Testing server", I have...
Server model: PHP mySQL
Access: Local/Network
Testing Server Folder: /Applications/MAMP/htdocs/cabintest
URL Prefix: http://localhost/cabintest/
NOTE: in the Tutorial, it says I should add "8888" if I'm using MAMP, but I think I read in another post of your that it was unnecessary.
At this point, when moving to another tab, I am getting an error that says:
The site URL prefix [/cabintest] for the testing server does not match the site URL prefix [/public_html] specificed in the Address for the site. This may cause pages using site relative links to display incorrectly at run time. Proceed anyway?
I'm sure this refers to when I was defining the site --
under "What is the http address (URL) of your site" I put
http://mywebsite.com/public_html/
I was thinking they wanted to know where I was going to post it later, so the links would be correct when I uploaded it... Wrong? Maybe that something I change when I'm going to upload it?
PHP LIVE TIME CODE
I tried adding the php code between the body tags, anyway (Hey, finally, something I knew how to do 😉
When I tried to preview in browser I get the error:
To preview pages containing server-side code, you need a testing server. Would you like to specify one now?
If I say yes, it takes me to a brand new "site definition" dialog box.
FYI:
- MAMP is on and running.
- I tried adding :8888 after localhost in the "URL prefix" box so it reads URL Prefix: http://localhost:8888/cabintest/ but that didn't seem to help.
- Firewall is not blocking mysqld.
I've tried "Mac" tutorials, and obviously I'm still doing something wrong. Feeling pretty stupid here, since I know this is all so basic.
Any thoughts? I could take screen shots of each "site definition" window if that would help. THANKS!
Copy link to clipboard
Copied
webnewbie10 wrote:
The wording appears to be different between Mac and Windows (and where/how you enter info in the define site dialog boxes.)
No, the wording is identical. It sounds as though you're using an older version of Dreamweaver.
In Dreamweaver CS4 and earlier, click the Advanced button at the top of the Site Definition dialog box.
The :8888 is required ONLY if you are using the MAMP default ports.
under "What is the http address (URL) of your site" I put http://mywebsite.com/public_html/
I was thinking they wanted to know where I was going to post it later, so the links would be correct when I uploaded it... Wrong? Maybe that something I change when I'm going to upload it?
You don't need to fill that in for testing, but in any event, it should NOT include public_html. That's your remote server's equivalent of htdocs, and does not form part of the URL.
Copy link to clipboard
Copied
THANK YOU!!! And sorry, maybe I forgot to mention I was using CS4... I hope someone does you a kind deed in the near future. I know my ignorance was probably very frustrating!
It's all working!
I also figured out why the "preview in browser" didn't work. (I'll add what I did incase any other newbies are having the same issue...)
I had saved my new PHP test file before I'd set up the site correctly. So it was saved to the wrong place. I made a new one, saved it in
/Applications/MAMP/htdocs/cabintest and now the preview and code "time is now" test is working. Teehee...
And phew...
Next, I used your excellent tutorial to set up the user and connect to a database.
http://www.adobe.com/devnet/dreamweaver/articles/setup_php.html#articlecontentAdobe_numberedheader_2
I am the only user, and I want to be able to do everything. I went thru the exercise of adding a new user (my name). As instructed, I left all the checkboxes under in Structure and Administration blank. I believe that means that I can't create new tables, databases under that user name. But it sounds like a safeguard to keep me from wiping out all the data when Im creating my site.
Just to clarify: I should use this new user name and password (instead of root, root) when connecting to the database
from my new PHP page in Dreamweaver.
At the end of the tutorial, I was so happy when I saw this message!!!!!
Congratulations! Your PHP development environment and site are now set up and you are ready to start developing PHP web applications in Dreamweaver.
One final question on this thread (I'm sure I'll have questions while working on my site, but will start a new thread, if so)
My site is mainly a search engine, to allow the user to look up the data in my database by many different variables, (size, location, city, etc...). Do you have any suggestions on good tutorials that focus on searching functions in a PHP page? Or good "for dummies" books that might help me thru. I've only ever created html pages (with alot of help from Dreamweaver...)
Thanks for your unending patience and support. Sending you virtual flowers, candy, or wine! Your choice 😉
Jami
Copy link to clipboard
Copied
I'm glad you finally got there in the end. If you're looking for tutorials, you might like to try this three-part tutorial that I wrote for Adobe: Build your first dynamic website with PHP. It starts quite simply, but gets progressively more advanced, so take it slowly.
You might also be interested in some of the books I have written. See my website, http://foundationphp.com/ for details. Since, you're using Dreamweaver CS4, The Essential Guide to Dreamweaver CS4 with CSS, Ajax, and PHP, is probably the best. For a more general, non-Dreamweaver specific approach, there's PHP Solutions, Second Edition. I try to credit readers with some intelligence, so I wouldn't call my books "for dummies". But they're written in a straightforward, non-jargon style, and seem to be well liked by many people.