|
|
|
|
||||||
| alt.apache.configuration Apache web server configuration issues. |
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I have the following HTML file:
(test.html) <HTML> This is in the HTML section. <?php $v1 = "<BR>And this is "; $v2 = "in the PHP section."; echo $v1 . $v2; ?> </HTML> When I access that file with my local copy of Apache 2.2.8, I get this: This is in the HTML section. And this is in the PHP section. But when I load test.html from my shared web hosting account running Apache 1.3.3, I get this: This is in the HTML section. And this is "; $v2 = "in the PHP section."; echo $v1 .$v2; ?> My local server does what I expect, but the shared host server just passes on (some of) the php code. If I change the name of the file from test.html to test.php, it works. Why does an html extension work on my local server but not on the remote one? Is it because of the older version of Apache? Or is there a setting that must be changed? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Hi
Does you shared Apache server load the right PHP in the httpd.conf file? Doesn't seam that way. As a suggestion I would recoment you to split the document int one PHP and one HTML file. file phpfile.php <?php $v1 = "<BR>And this is "; $v2 = "in the PHP section."; // Note that I changed to printf in steat of echo printf("%s %s\n", $v1 . $v2 ); ?> htm file <HTML> This is in the HTML section. <?php #nclude "phpfile.php" ?> Lars "Paul Pedersen" <nospam@no.spam> skrev i meddelandet news:we-dndIWpLOnHi3anZ2dnUVZ_jednZ2d@comcast.com... >I have the following HTML file: > > (test.html) > > <HTML> > > This is in the HTML section. > > <?php > $v1 = "<BR>And this is "; > $v2 = "in the PHP section."; > echo $v1 . $v2; > ?> > > </HTML> > > > When I access that file with my local copy of Apache 2.2.8, I get this: > > This is in the HTML section. > And this is in the PHP section. > > > But when I load test.html from my shared web hosting account running > Apache 1.3.3, I get this: > > This is in the HTML section. And this is "; $v2 = "in the PHP section."; > echo $v1 .$v2; ?> > > > My local server does what I expect, but the shared host server just passes > on (some of) the php code. If I change the name of the file from test.html > to test.php, it works. > > > Why does an html extension work on my local server but not on the remote > one? Is it because of the older version of Apache? Or is there a setting > that must be changed? > > > > > > |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Thank you for your response.
No, that does not work. (I had to tweak your example a little.) The same thing happens - it works fine on my local 2.2.8 Apache, but the remote 1.3.3 Apache simply returns the <?php ... ?> section literally: <HTML> This is in the HTML section. <?php include("phpfile.php"); ?> </HTML> "Lars" <jon.doe@xxxxxxxxxxxxxxxxxx.xxx> wrote in message news:xG%rj.3749$R_4.2531@newsb.telia.net... > Hi > > Does you shared Apache server load the right PHP in the httpd.conf file? > Doesn't seam that way. > > As a suggestion I would recoment you to split the document int one PHP and > one HTML file. > > > file phpfile.php > <?php > > $v1 = "<BR>And this is "; > $v2 = "in the PHP section."; > > // Note that I changed to printf in steat of echo > printf("%s %s\n", $v1 . $v2 ); > > ?> > > > htm file > <HTML> > > This is in the HTML section. > > <?php > #nclude "phpfile.php" > ?> > > > > > > Lars > > > "Paul Pedersen" <nospam@no.spam> skrev i meddelandet > news:we-dndIWpLOnHi3anZ2dnUVZ_jednZ2d@comcast.com... >>I have the following HTML file: >> >> (test.html) >> >> <HTML> >> >> This is in the HTML section. >> >> <?php >> $v1 = "<BR>And this is "; >> $v2 = "in the PHP section."; >> echo $v1 . $v2; >> ?> >> >> </HTML> >> >> >> When I access that file with my local copy of Apache 2.2.8, I get this: >> >> This is in the HTML section. >> And this is in the PHP section. >> >> >> But when I load test.html from my shared web hosting account running >> Apache 1.3.3, I get this: >> >> This is in the HTML section. And this is "; $v2 = "in the PHP section."; >> echo $v1 .$v2; ?> >> >> >> My local server does what I expect, but the shared host server just >> passes on (some of) the php code. If I change the name of the file from >> test.html to test.php, it works. >> >> >> Why does an html extension work on my local server but not on the remote >> one? Is it because of the older version of Apache? Or is there a setting >> that must be changed? >> >> >> >> >> >> > > |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
"Paul Pedersen" <nospam@no.spam> skrev i meddelandet news:gbudndc9QfYLDS3anZ2dnUVZ_o6knZ2d@comcast.com. .. > Thank you for your response. > > No, that does not work. (I had to tweak your example a little.) > > The same thing happens - it works fine on my local 2.2.8 Apache, but the > remote 1.3.3 Apache simply returns the <?php ... ?> section literally: Does Apache 1.3.3 support inline PHP scripting in HTML files. Try moving the script to another file and see what happens. Or try this Write a file that exactly as this. Save it as phpinfo.php then upload the file and access it. You get lots of information about you server this way. <?php phpinfo(); ?> Outputs a large amount of information about the current state of PHP. This includes information about PHP compilation options and extensions, the PHP version, server information and environment (if compiled as a module), the PHP environment, OS version information, paths, master and local values of configuration options, HTTP headers, and the PHP License. Lars > > <HTML> > > This is in the HTML section. > > <?php > include("phpfile.php"); > ?> > > </HTML> > > > "Lars" <jon.doe@xxxxxxxxxxxxxxxxxx.xxx> wrote in message > news:xG%rj.3749$R_4.2531@newsb.telia.net... >> Hi >> >> Does you shared Apache server load the right PHP in the httpd.conf file? >> Doesn't seam that way. >> >> As a suggestion I would recoment you to split the document int one PHP >> and one HTML file. >> >> >> file phpfile.php >> <?php >> >> $v1 = "<BR>And this is "; >> $v2 = "in the PHP section."; >> >> // Note that I changed to printf in steat of echo >> printf("%s %s\n", $v1 . $v2 ); >> >> ?> >> >> >> htm file >> <HTML> >> >> This is in the HTML section. >> >> <?php >> #nclude "phpfile.php" >> ?> >> >> >> >> >> >> Lars >> >> >> "Paul Pedersen" <nospam@no.spam> skrev i meddelandet >> news:we-dndIWpLOnHi3anZ2dnUVZ_jednZ2d@comcast.com... >>>I have the following HTML file: >>> >>> (test.html) >>> >>> <HTML> >>> >>> This is in the HTML section. >>> >>> <?php >>> $v1 = "<BR>And this is "; >>> $v2 = "in the PHP section."; >>> echo $v1 . $v2; >>> ?> >>> >>> </HTML> >>> >>> >>> When I access that file with my local copy of Apache 2.2.8, I get this: >>> >>> This is in the HTML section. >>> And this is in the PHP section. >>> >>> >>> But when I load test.html from my shared web hosting account running >>> Apache 1.3.3, I get this: >>> >>> This is in the HTML section. And this is "; $v2 = "in the PHP section."; >>> echo $v1 .$v2; ?> >>> >>> >>> My local server does what I expect, but the shared host server just >>> passes on (some of) the php code. If I change the name of the file from >>> test.html to test.php, it works. >>> >>> >>> Why does an html extension work on my local server but not on the remote >>> one? Is it because of the older version of Apache? Or is there a setting >>> that must be changed? >>> >>> >>> >>> >>> >>> >> >> > > |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
"Lars" <jon.doe@xxxxxxxxxxxxxxxxxx.xxx> wrote in message news:H14sj.3756$R_4.2795@newsb.telia.net... > > Does Apache 1.3.3 support inline PHP scripting in HTML files. Yes, that was my original question. Or is there a setting that allows that? > <?php > phpinfo(); > ?> I've done that, but being new to web programming, I don't know what most of that stuff means. I didn't see anything relevant that was obvious to me. Thanks anyway. I guess I just won't try to embed php code in html files, because that doesn't seem to work reliably. |
|
![]() |
| Outils de la discussion | |
|
|