Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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?

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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"


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •