Home  |  Linux  | Mysql  | PHP  | XML
From:Keith Roberts Date:Sun Apr 13 15:06:16 2008
Subject:Re: Help!
On Sun, 13 Apr 2008, Bryan wrote:
> To: php-install@lists.php.net
> From: Bryan <bac512@hotmail.com>
> Subject: [PHP-INSTALL] Help!
> 
> I've just set up my Apache server with mySql and PHP, and 
> for the most part everything works fine, except:
>
> I can't embed PHP in an HTML file (if my server starts up 
> with INDEX.HTML I can't do anything with PHP, is this 
> possible, or am I just off the deepend here?)

In httpd.conf look for lines like this:

# AddType allows you to add to or override the MIME configuration
# file mime.types for specific file types.
...
AddType application/x-httpd-php .php
AddType application/x-httpd-php .hml
AddType application/x-httpd-php .htm
AddType application/x-httpd-php .html
AddType application/x-httpd-php .conf
AddType application/x-httpd-php .js

Any file with a name ending in any of the above filename 
extensions will be processed by the Apache php module. Make 
your own up as required, within reason of course.

> Also, when I run a PHP file, it doesn't seem to pay any 
> attention to the \n in the echo or print statements.  I 
> copied the examples straight from the examples on PHP.Net, 
> and I installed everything exactly as the instructions 
> said to, but from reading all the comments and such, it 
> appears I'm the only one having these problems?  What's 
> going on/what am I doing wrong?

There are two version of PHP - the Apache module one that 
you seem to be using. There is also a command line version 
of PHP, that you can execute directly from the command line.

The examples that use "\n" for newlines you found are 
written for the command line version of PHP.

If you type:

$ php -a

at the command line, you will enter PHP CLI interactive 
mode. You can then use PHP like a BASIC interpreter. This version 
of PHP will expect a newline to be \n.

When you code for the Apache PHP module you will need to use 
<br /> for your newlines, as any output from the PHP Apache 
module will be sent to the browser, and must be in (x)html 
format. (The browser expects <br /> as a newline, not \n, 
and vica versa for the CLI version of PHP.)

HTH

Keith Roberts

-----------------------------------------------------------------
Websites:
http://www.php-debuggers.net
http://www.karsites.net
http://www.raised-from-the-dead.org.uk

All email addresses are challenge-response protected with
TMDA [http://tmda.net]
-----------------------------------------------------------------
Navigate in group php.install at sever news.php.net
Previous Next




  
© No Copyright
You are free to use Anything
Site Maintained by Zareef Ahmed
Powered By PHP Consultants