CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Apache configuration (http://www.codingforums.com/forumdisplay.php?f=69)
-   -   Setting up php on apache (http://www.codingforums.com/showthread.php?t=269238)

BuzzMcPhearson 08-01-2012 12:16 AM

Setting up php on apache
 
Here's what I got:
Installed php on my apache server per instructions.
Created a simple php form that opens the same page with - action="<?php $_SERVER['../PHP_SELF'];?>" But instead of opening the page it downloads it. The page works fine on other servers, but not the one that I set up the php.ini on. I'm assuming I messed something up during the configuration process. I did try using phpinfo() on a page and that worked fine. Any thoughts?

Fou-Lu 08-01-2012 12:38 AM

First you need to load the module. That's done like so:
Code:

LoadModule php5_module "/path/to/php/php5apache2_4.dll"
That path is very specific to the php version and apache build. You'll need to look through and verify it against the version of apache you have (also very specific to the architecture and threading capabilities), and choose the proper version. It's name is: php{major}apache{major}_{minor}.dll/.so.

Next you need to add the type:
Code:

    AddType application/x-httpd-php .php
I usually wrap mine in mod_mime.c check.

Finally if you want it, you can add a directory index. Search for DirectoryIndex and simply add in index.php. These are separated by spaces.

Restart apache for the settings to take affect.
For an example, this is what I've done for 5.4 build:
Code:

<IfDefine PHP_5_4_0>
  LoadModule php5_module "D:/Server/PHP/php-5.4.0/php5apache2_4.dll"
  PHPINIDir "D:/Server/PHP/PHP-5.4.0/"
  <IfModule mod_mime.c>
    AddType application/x-httpd-php .php
    AddType application/x-httpd-php-source .phps
  </IfModule>
</IfDefine>

That lets me load a module for PHP5, set its directory and add its type.

BuzzMcPhearson 08-01-2012 02:14 AM

I originally put this at the end of the LoadModule lines:
Code:

LoadModule php5_module "c:/php/php5apache2_2.dll"
Added this to the end of the AddType Lines:
Code:

AddType application/x-httpd-php .php
And put this at the very end of the conf file:
Code:

PHPIniDir "c:/php"


All times are GMT +1. The time now is 01:43 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.