|
Posted by Carl Pearson on 02/07/07 14:46
Rob wrote:
> ...and the latest distribution of PHP for same. Apache tells me it's
> up & running, but I don't know what I need to do to run my PHP
> scripts. What do I do?
>
For Apache to 'know' it's a php file, it has to have a php extension,
i.e., index.php
Putting php statements inside index.html will NOT work.
(Actually, that's not exactly true. Apache uses a file's extension to
decide how to parse a particular file. The extension that will get
parsed by the PHP processor is defined in your Apache conf, and can be
anything you prefer. Most folks just use .php though...)
Also, you should verify PHP is actually running.
Make a file - test.php, whatever, just make sure it has a 'php'
extension - which has this one line:
<?php phpinfo(); ?>
Put it in your documentroot (if you're not sure where that is, look in
your Apache's httpd.conf for the word 'DocumentRoot') and call it up in
the browser.
You should see a nice purple header with your PHP version, and a bunch
of other info. If you do, PHP is running.
If not, the Apache config has probably not been set up. Check for lines
like these in httpd.conf:
#replace "/path/to" with the actual path to these files...
LoadFile "/path/to/php5ts.dll"
LoadModule php5_module "/path/to/php5apache2_2.dll"
<IfModule php5_module>
<Location />
AddType text/html .php .phps
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .phps
</Location>
</IfModule>
Also, Apache "likes" the php.ini to be in its own Apache bin folder.
Restart Apache, and you should be good to go.
Navigation:
[Reply to this message]
|