|
Posted by Rob on 02/08/07 22:57
On Feb 7, 6:46 am, Carl Pearson <jman_spam_trap_....@gmail.com> wrote:
> 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.
I went to the "httpd.conf" file, and added this:
# For PHP 5 do something like this:
LoadModule php5_module "C:\Program Files\PHP\php5apache2_2_4.dll"
AddType application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:\Program Files\PHP"
and then ran the "<?php phpinfo(); ?>" script. It ran (correctly) in
my browser, but then an error message came up, shutting down apache. I
turned apache back on; the same thing happened again-- but this time,
when I tried to turn it back on, an error message came up, telling me
the operation couldn't be performed (wouldn't run apache). I restarted
my computer; Apache wouldn't start again (same error message).
I removed the added lines from the "httpd.conf" file, and restarted
everything. Everything ran fine; but when I re-added the "LoadModule
php5_module..." code, it wouldn't start apache. What's going on? And
what do I do now?
Navigation:
[Reply to this message]
|