logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Other Software View previous topic :: View next topic
Reply to topic   Topic: Apache 2.2.2 and PHP 5.1.4 Installation Issues and Questions
Author
Aznsilvrboy



Joined: 06 Jul 2006
Posts: 11

PostPosted: Thu 06 Jul '06 23:21    Post subject: Apache 2.2.2 and PHP 5.1.4 Installation Issues and Questions Reply with quote

Hi, I'm just starting to learn (or trying to) learn PHP and MySQL. I've bought a "PHP and MySQL for Dummies" book to help me. The first thing i need to do is setup Apache, then MySQL and finally PHP. Software versions are as the title suggests, MySQL version is 5.0. Operation System is Windows XP Pro

Anyways I have a question about the following:

I'm trying to configure Apache for PHP and according to the book I'm to insert 3 lines into the httpd.conf file for Apache:

ScripAlias /php/ "c:php/"
Action application/x-httpd-php/php/php/php-cgi.exe
AddType applicaion/x-httpd-php .php

I'm able to find the places to insert all but 1 line (bolded). I can't find the place in the httpd.conf to insert Action application/x-httpd-php/php/php/php-cgi.exe

Another question is, where should the php.ini file be? I currently have it in C:\Windows\

What should I do? I read from php.net that there is an alternative to configuring Apache for PHP:

------------------------------------------------------

Installing as an Apache module

You need to insert these two lines to your Apache httpd.conf configuration file to set up the PHP module for Apache 2.0:

Example 6-6. PHP and Apache 2.0 as Module

# For PHP 5 do something like this:
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir "C:/php"


-------------------------------------------------------

I know how to do the first #, but have no idea about configuring the path to php.ini (bolded). What can I do? Thanks.
Back to top
pnllan



Joined: 05 Dec 2005
Posts: 221

PostPosted: Fri 07 Jul '06 7:15    Post subject: Reply with quote

First, you realize that you either setup PHP to run as CGI or as a module...you cannot do both.

CGI is setup using these directives:

ScripAlias /php/ "c:php/"
Action application/x-httpd-php/php/php/php-cgi.exe
AddType applicaion/x-httpd-php .php

As a module using these directives:

LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php


The ACTIONS directive can be added to the block that you inserted the AddType directive.

Most people favor running PHP as a module. Many of us here leave the PHP.INI file in the PHP folder. Then we use the Apache directive PHPIniDir to indicate to Apache where the INI file is. Then add the folder that contains PHP to the Path (Control Panel, System properties | Advanced tab | Environment Variables button | System variables combo box | scroll to PATH | Edit button). For example: Add ;C:\php to the end of the PATH statement.

How's that?
..
.
Back to top
Aznsilvrboy



Joined: 06 Jul 2006
Posts: 11

PostPosted: Fri 07 Jul '06 16:45    Post subject: Reply with quote

pnllan wrote:
First, you realize that you either setup PHP to run as CGI or as a module...you cannot do both.

CGI is setup using these directives:

ScripAlias /php/ "c:php/"
Action application/x-httpd-php/php/php/php-cgi.exe
AddType applicaion/x-httpd-php .php

As a module using these directives:

LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php


The ACTIONS directive can be added to the block that you inserted the AddType directive.

Most people favor running PHP as a module. Many of us here leave the PHP.INI file in the PHP folder. Then we use the Apache directive PHPIniDir to indicate to Apache where the INI file is. Then add the folder that contains PHP to the Path (Control Panel, System properties | Advanced tab | Environment Variables button | System variables combo box | scroll to PATH | Edit button). For example: Add ;C:\php to the end of the PATH statement.

How's that?
..
.


Yea I realize i can only do one of either type of installations. If i were to install it as a module, which block of the httpd.conf do i add the PHPIniDir directive? As for adding the folder that contains PHP to the Path, I tried going to where you said it would be, but there's only "Path" not "PATH". Are they different? Also "Path" already has a defined value:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Common Files\Adobe\AGL;C:\Program Files\MySQL\MySQL Server 5.0\bin

After trying to setup PHP as CGI and trying to run my test.php page, i get this error:

Forbidden

You don't have permission to access /php/php-cgi.exe/test.php on this server.

I think it's because my php.ini in my C:\Windows\ is not properly configured. What should I do? Thanks.
Back to top
pnllan



Joined: 05 Dec 2005
Posts: 221

PostPosted: Fri 07 Jul '06 17:45    Post subject: Reply with quote

Maybe I should have bolded Path rather than all cappaing it. Whichever, you found it. If you have PHP in C:\PHP, then just add it to the end of the Path statement:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Common Files\Adobe\AGL;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\php

To Setup as a module, just add the 'module lines' after the long series of LoadModule directives:

...
LoadModule status_module modules/mod_status.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule ssl_module modules/mod_ssl.so

#This is for PHP to run as a module
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"

If you use a module, save yourself some time and download the php5apache2.dll from the Download page. Follow the instructions in the ZIP file.
Back to top
Aznsilvrboy



Joined: 06 Jul 2006
Posts: 11

PostPosted: Fri 07 Jul '06 21:48    Post subject: Reply with quote

pnllan wrote:
Maybe I should have bolded Path rather than all cappaing it. Whichever, you found it. If you have PHP in C:\PHP, then just add it to the end of the Path statement:

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Common Files\Adobe\AGL;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\php

To Setup as a module, just add the 'module lines' after the long series of LoadModule directives:

...
LoadModule status_module modules/mod_status.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule ssl_module modules/mod_ssl.so

#This is for PHP to run as a module
LoadModule php5_module "c:/php/php5apache2.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:/php"

If you use a module, save yourself some time and download the php5apache2.dll from the Download page. Follow the instructions in the ZIP file.


Thanks, I "think" i've got it working correctly as my test.php page works. I've downloaded the php5apache2.dll package from the Download page, followed the instructions except 1, which is to install the Visual C++ 2005 Redistributable Package. Do I really need to install that? Thanks.
Back to top
pnllan



Joined: 05 Dec 2005
Posts: 221

PostPosted: Sat 08 Jul '06 0:06    Post subject: Reply with quote

Visual C++ 2005 Redistributable Package is used since Steffen compiles with Visual C++ 2005. It is small, free, and ensures future compatibility. I highly recommend it.
Back to top


Reply to topic   Topic: Apache 2.2.2 and PHP 5.1.4 Installation Issues and Questions View previous topic :: View next topic
Post new topic   Forum Index -> Other Software