Web solutions for webmasters and business professionals.
View Full Version : Cannot preview site in browser through testing serverphp
Pauloneill79
January 11th, 2008, 04:05 AM
Hello all,
Graphic designer here looking for help regarding PHP. I've traditionally just
updated websites and done design tweeking in html. I'm now moving into the PHP
and CSS understanding.
Recently inherited a website with PHP setup on it. I'm now trying to set up a
testing server. Previously, I had just used ftp and testing the html file on my
local drive. Obviously this method isn't possible with PHP
Followed the tutorial here
http://www.adobe.com/devnet/dreamweaver/articles/setting_up_php_04.html
and now have the PHP set up and the sites testing server working.
The only problem is the when I open the index.php file and preview in browser
F12 the page appears like a html missing it's CSS. The elements but there not
picking up the CSS.
The folder structure is correct with remote site i.e .the css in is the right
folder.
Does anyone know why my index.php won't show up correctly?
--
Dreamweaver MX 2004
Dual 2 GHz PowerPC G5
1.5GB
http://www.adobe.com/devnet/dreamweaver/articles/setting_up_php_04.htmlhttp://ht
tp://www.adobe.com/devnet/dreamweaver/articles/setting_up_php_04.html
Murray *ACE*
January 11th, 2008, 04:05 AM
> F12 the page appears like a html missing it's CSS
Upload the CSS file to the testing server.
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================
"Pauloneill79" <webforumsuser@macromedia.com> wrote in message
news:fm517d$gmp$1@forums.macromedia.com...
> Hello all,
> Graphic designer here looking for help regarding PHP. I've traditionally
> just
> updated websites and done design tweeking in html. I'm now moving into the
> PHP
> and CSS understanding.
>
> Recently inherited a website with PHP setup on it. I'm now trying to set
> up a
> testing server. Previously, I had just used ftp and testing the html file
> on my
> local drive. Obviously this method isn't possible with PHP
>
> Followed the tutorial here
> http://www.adobe.com/devnet/dreamweaver/articles/setting_up_php_04.html
> and now have the PHP set up and the sites testing server working.
>
> The only problem is the when I open the index.php file and preview in
> browser
> F12 the page appears like a html missing it's CSS. The elements but there
> not
> picking up the CSS.
> The folder structure is correct with remote site i.e .the css in is the
> right
> folder.
>
> Does anyone know why my index.php won't show up correctly?
>
> --
> Dreamweaver MX 2004
> Dual 2 GHz PowerPC G5
> 1.5GB
>
>
> http://www.adobe.com/devnet/dreamweaver/articles/setting_up_php_04.htmlhttp://ht
> tp://www.adobe.com/devnet/dreamweaver/articles/setting_up_php_04.html
>
Pauloneill79
January 11th, 2008, 04:05 AM
Thanks Murray ACE,
The CSS looks in order. same as the remote site.
i'm now getting a hangin blank page when i preview? it eventually times out.
Murray *ACE*
January 11th, 2008, 04:08 AM
Sorry - I don't know. What do you get when you browse to http://localhost?
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================
"Pauloneill79" <webforumsuser@macromedia.com> wrote in message
news:fm540b$jlg$1@forums.macromedia.com...
> Thanks Murray ACE,
>
> The CSS looks in order. same as the remote site.
>
> i'm now getting a hangin blank page when i preview? it eventually times
> out.
Pauloneill79
January 11th, 2008, 04:08 AM
I've relinked to localhost and it works. There seems to be a problem pointing
my computers IP.
The testing server has the css files in the right place, a styelsheets
folder... so everything looks in order as regard CSS put the page still
previews without it's css.
Pauloneill79
January 11th, 2008, 04:09 AM
I've relinked to localhost and it works. There seems to be a problem when
pointing to my computers IP.
The testing server has the css files in the right place, a styelsheets
folder... so everything looks in order as regard CSS put the page still
previews without it's css.
Alan
January 11th, 2008, 04:09 AM
> so everything looks in order as regard CSS put the page still
> previews without it's css.
Is the link to the external .css file document relative or site root
relative? Does it start with a leading /slash?
Site root relative paths won't work if the "site root" in is in a subfolder
such as http://localhost/mysite/
--
Alan
Adobe Community Expert, dreamweaver
http://www.adobe.com/communities/experts/
Pauloneill79
January 11th, 2008, 04:15 AM
tnx alan.
the href to the stylesheets in the header.inc.php loooks like this
<link href="/stylesheets/screen.css" media="screen" rel="Stylesheet"
type="text/css" />
<link href="/stylesheets/print.css" media="print" rel="Stylesheet"
type="text/css" />
There are slashes before "stylesheets/screen.css". But the stylesheets folder
and index are on the same level, the top level of the server so this shouldn't
be an issue.
Or have I overlooked something?
Alan
January 12th, 2008, 04:21 AM
> There are slashes before "stylesheets/screen.css". But the stylesheets folder
> and index are on the same level, the top level of the server so this shouldn't
> be an issue.
but it IS an issue. It is the exact cause of the problem you are trying to
solve.
If your testing server url is:
http://localhost/mysite/
and the css link is <link href="/stylesheets/screen.css then the browser
will look here for the file:
http://localhost/stylesheets/screen.csss
and it's not there. so unstyled content.
quick fix- use only document relative paths.
Fix:
Either Don't use site root relative paths, or set up a "virtual host" in the
OS and server so you can use a testing server url like http://mysite.local
and site root relative paths will work locally.
--
Alan
Adobe Community Expert, dreamweaver
http://www.adobe.com/communities/experts/
Pauloneill79
January 16th, 2008, 04:35 AM
Tnx for your help Alan,
I do understand the "absolute" and "relevant" issue.
I've had a brief conversation with the original creator of the site and he has
told me how he has tested the php on his machine. He basically created a folder
on his machine with the Apache server set up on it. He then places everything
in that so there are no "absolute" & "relative" linking problems.
The OS on my mac has a localhost apache folder under each users account
localhost/~pauloneill/MySite
This reckons the ~pauloneill is causing the problem. So my next question is...
is there a way (through the terminal) to override the username here?
Murray *ACE*
January 16th, 2008, 04:35 AM
> I do understand the "absolute" and "relevant" issue.
You mean "root relative" and "document relative"?
--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
==================
"Pauloneill79" <webforumsuser@macromedia.com> wrote in message
news:fmil63$n8k$1@forums.macromedia.com...
> Tnx for your help Alan,
> I do understand the "absolute" and "relevant" issue.
>
> I've had a brief conversation with the original creator of the site and he
> has
> told me how he has tested the php on his machine. He basically created a
> folder
> on his machine with the Apache server set up on it. He then places
> everything
> in that so there are no "absolute" & "relative" linking problems.
>
> The OS on my mac has a localhost apache folder under each users account
> localhost/~pauloneill/MySite
>
> This reckons the ~pauloneill is causing the problem. So my next question
> is...
> is there a way (through the terminal) to override the username here?
>
Alan
January 16th, 2008, 04:35 AM
read the last reply again.
a path that starts with a leading /slash is a SITE ROOT relative path.
it will NOT work if your testing server url is
http://localhost/~pauloneill/MySite/
because it will be relative to the ROOT, and start from localhost/ and not
start from MySite/
so- same two choices.
Use only DOCUMENT relative paths.
The fix in the example page given is to change
<link href="/stylesheets/screen.css
to
<link href="stylesheets/screen.css
done. period. it will now show during local preview, and will show on the
remote server also.
When making new paths or fixing old ones, look for and find the pulldown
that's in the bottom of the "browse to file" dialog box.
change it from "relative to site root" to "relative to document"
Or if you want to use site root relative paths, do some research and set up
"virtual hosts" on your local machine and server so you can assign a fake
domain name to this folder and be able to use something like
http://mysite.local/ as the testing server url
--
Alan
Adobe Community Expert, dreamweaver
http://www.adobe.com/communities/experts/
Pauloneill79
January 16th, 2008, 04:35 AM
Sorry. Yes i mean "root relative" and "document". I typed that previous line
wrong. I'm under major pressure from the boss to get a grip on this problem
here in work so i'm quiet frantic when typing.
I could everything in the manuallyt to make it work on my localhost and then
change it all when i upload to the remote server. This highly not reccommended
and a potential nightmare?
any ideas? how do i create a folder (outside the default OS) with the apache
server set up on it? I'm on OS X.4.11 G5
(_seb_)
January 16th, 2008, 04:35 AM
Alan wrote:
> read the last reply again.
>
> a path that starts with a leading /slash is a SITE ROOT relative path.
>
> it will NOT work if your testing server url is
> http://localhost/~pauloneill/MySite/
>
> because it will be relative to the ROOT, and start from localhost/ and not
> start from MySite/
>
> so- same two choices.
>
> Use only DOCUMENT relative paths.
>
> The fix in the example page given is to change
> <link href="/stylesheets/screen.css
> to
> <link href="stylesheets/screen.css
> done. period. it will now show during local preview, and will show on the
> remote server also.
>
> When making new paths or fixing old ones, look for and find the pulldown
> that's in the bottom of the "browse to file" dialog box.
>
> change it from "relative to site root" to "relative to document"
>
> Or if you want to use site root relative paths, do some research and set up
> "virtual hosts" on your local machine and server so you can assign a fake
> domain name to this folder and be able to use something like
> http://mysite.local/ as the testing server url
>
here's how to setup a virtual host on a Mac (only solution to use site relative paths for your local
testing site):
setup virtual local host:
open NetInfo Manager (Utilities)
browse to machines/
unlock, click on localhost, duplicate (edit, duplicate)
select localhost copy,
then change the value of name to whatever test name.
Click on something else to be prompted to save, save.
Open Terminal, enter:
cd /private/etc/httpd/
then:
sudo pico httpd.conf
-> enter your user password
Ctrl is the short cut said "^" to navigate through.
Go to section 3
find the virtual host code example, make another one.
The site folder has to be in
Library/WebServer/Documents/
control-x to save the changes, then y (yes) to confirm, then Enter.
--
seb (@webtrans1.com)
high-end web design: http://webtrans1.com
an ingenious website builder: http://sitelander.com
music: http://myspace.com/popmodelberlin
Alan
January 16th, 2008, 04:35 AM
> I could everything in the manuallyt to make it work on my localhost and then
> change it all when i upload to the remote server. This highly not reccommended
> and a potential nightmare?
if you only use document relative paths- they will work both locally and on
the remote server.
Do a find in source sitewide for this:
"/
and change those paths from site root relative to document relative
then do a find for:
'/ to catch any that might be in a javascript
--
Alan
Adobe Community Expert, dreamweaver
http://www.adobe.com/communities/experts/
Pauloneill79
January 16th, 2008, 04:37 AM
tnx seb.
"find the virtual host code example, make another one."
I'm not sure how to make another one. do you mean to copy what's there as the
example and paste it some where else.
it looks like this.
<VirtualHost *:80>
# ServerAdmin webmaster@dummy-host.example.com
# DocumentRoot /www/docs/dummy-host.example.com
# ServerName dummy-host.example.com
# ErrorLog logs/dummy-host.example.com-error_log
# CustomLog logs/dummy-host.example.com-access_log common
#</VirtualHost>
<IfModule mod_php4.c>
# If php is turned on, we repsect .php and .phps files.
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
# Since most users will want index.php to work we
# also automatically enable index.php
<IfModule mod_dir.c>
DirectoryIndex index.html index.php
</IfModule>
</IfModule>
Clancy
January 16th, 2008, 04:43 AM
"Pauloneill79" <webforumsuser@macromedia.com> wrote:
>Sorry. Yes i mean "root relative" and "document". I typed that previous line
>wrong. I'm under major pressure from the boss to get a grip on this problem
>here in work so i'm quiet frantic when typing.
David Powers book 'PHP for Dreamweaver 8' has very clear instructions on how to
set up a site using Apache and php. I have only used it on a PC, but I got them
working reasonably quickly. The other day I used it to install them on my
laptop, so I could demonstrate my web sites offline, and again I had little
trouble, apart from the inevitable typos.
Well worth the money.
Clancy
Pauloneill79
January 17th, 2008, 03:07 AM
Tnx Clancy,
I've put a request in with the powers that be to order one. Hopefully it will help. Self-training can be tough in a small company. :)
Pauloneill79
January 17th, 2008, 03:08 AM
Seb,
I've been investigating how to make edits to the httpd.conf and have received
this advice.
"I use emacs to edit the httpd.conf file, but you also have vi and pico at
your disposal, and you can use TextEdit or BBEdit if you like. I only use emacs
because it's what I know and I like the safety of not having an application
opened as root (which is what you'd get if you used open -a and used BBEdit or
TextEdit)."
so i edit the httpd.conf through a text editor (in the case Emacs is
preferred). So can i use textedit? but how does this change the httpd.conf file
if it's just a string of text in a text editor?
Pauloneill79
January 18th, 2008, 03:43 AM
Tnx to everyone... i got it working!
I got the virtualhost to work by downloading textmate for my mac. i then
opened up the terminal and commanded it to open the httpd.conf file through
text mate.
i then went to section 3 virtualhost.
copied the example code and tailored a new piece of code to what i wanted. ie
<VirtualHost 270.0.0.1>
DocumentRoot /www/docs/my/website
ServerName mywebsite
</VirtualHost>
and the index page now appears in the browser.
but the next problem now is the CSS is still not previewing properly. Upon
inspection of the sourec code in the browser it is have trouble deciphering the
exceptions in the php.
this is the first piece of code that gives me problems
<title><?= $section ?><? if (isset($sub_title)) echo " - {$sub_title}"?> - My
Website</title>
it actually appears in the title of the page so something isn't right there.
(my first guess is that maybe it's the version of apache i have running. PHP
5.2.4-1)
any ideas?
Alan
January 18th, 2008, 03:44 AM
first guess- are php short tags disabled?
do the statements work if you make them normal?
--
Alan
Adobe Community Expert, dreamweaver
http://www.adobe.com/communities/experts/
Pauloneill79
January 18th, 2008, 03:46 AM
Alan,
Is there a preference in DW MX 2004 that I can switch on?
BioPatterns
February 13th, 2008, 03:55 AM
Hello,
Did you ever solve your problem? I'm also having problems previewing php
files in Dreamweaver CS3. I bought David Power's book as suggested in this
thread and successfully set up a virtual host on my Mac. I can view the pages
when I type the address in Safari; however, in Dreamweaver, I only see code.
Copyright ©2000-2007, Jelsoft Enterprises Ltd.