Solved

PHP won't serve page

Posted on 2006-11-21
7
310 Views
Last Modified: 2010-03-04
I am running apache 2.2 with PHP 5.2 on windows 2000 server

My apache server is serving up htm/html fine.

My PHP install doesn't seem to want to serve up PHP pages.  I have a test.php created as follows:

<?
phpinfo()
?>

When I tried running PHP as a module, the page was blank.

When I tired runnign PHP as CGI, I simply get the text of my php page.

My HTTP.conf has the following added:

#BEGIN PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL
ScriptAlias /php/ "C:\PHP"
Action application/x-httpd-php "C:\PHP\php-cgi.exe"
#END PHP INSTALLER EDITS - REMOVE ONLY ON UNINSTALL


My mimi.types has the following added:

application/x-httpd-php      php
application/x-httpd-php-source      phps

Where do I go from here?
0
Comment
Question by:jeffreyscottsmith
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 13

Expert Comment

by:rhickmott
ID: 17992485
You want to stick with modules if you can its far more efficient than CGI. Not that it matters much but add a; to your phpinfo() declaration and actually declare it as PHP if you havent set the INI path then php will use defaults and short tags may not be switched on by default causing it to be ignored

So basiclly your index.php page should look like

<?php
        phpinfo();
?>

in your httpd.conf

Under your Load Modules

LoadModule php5_module "C:/www/PHP/php5apache2_2.dll"

( Substitute your PHP path and note the 2_2.dll make sure its there )



# ------------------------------------------ MIME Types -----------------------------------------------

DefaultType text/plain

<IfModule mime_module>
    TypesConfig conf/mime.types
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz
    AddType application/x-httpd-php .php
    PHPIniDir "C:/www/php"
</IfModule>


Substitute PHPIniDir for yours and make sure your correct php.ini file is in that folder.

Lastly Add index.php to your DirectoryIndex string.
0
 

Author Comment

by:jeffreyscottsmith
ID: 17997175
Ok, I get my test.php to launch.  Here is something extremely strange.  My httpd.conf area for PHP is below:
____________________________________________________________________

PHPIniDir "C:\PHP\"
LoadModule php5_module "C:/PHP/php5apache2_2.dll"

# ------------------------------------------ MIME Types -----------------------------------------------

DefaultType text/plain

<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType application/x-httpd-php .php
PHPIniDir "C:/www/php"
</IfModule>

____________________________________________________________________


Here is what is very, very strange,  My PHP directory is c:\php and my ini file is there.

If I comment out the PHPIniDir "C:\PHP\" (which is the correct location) test.php won't load.

If I change to the correct directory or comment out PHPIniDir "C:/www/php" in the section you gave me, test.php won't load.

I guess what I am saying is if I change either of the phpinidir paths or comment out, the page doesn't serve.

What is going on?
0
 
LVL 13

Expert Comment

by:rhickmott
ID: 17997333
Most Odd try changing

=============
PHPIniDir "C:\PHP\"
LoadModule php5_module "C:/PHP/php5apache2_2.dll"
=============
to
=============
LoadModule php5_module "C:/PHP/php5apache2_2.dll"
PHPIniDir "C:/PHP"
=============

It might be something to do with you calling it before after the module and the fact you have got it twice.

Loose it from the <IfModule mime_module> section.

So it should look like.

===============================

LoadModule php5_module "C:/PHP/php5apache2_2.dll"
PHPIniDir "C:/PHP"

DefaultType text/plain

<IfModule mime_module>
      TypesConfig conf/mime.types
      AddType application/x-compress .Z
      AddType application/x-gzip .gz .tgz
      AddType application/x-httpd-php .php
</IfModule>

===============================

See what that gives you.


At the top of your test.php ( if it doesent have it already)

add

<?php
     phpinfo();
?>

In the first box it will say

Configuration File (php.ini) Path

Mine says c:\windows\php.ini because im too lazy to change it :) but mine Is in there so its not an issue.

if it says C:\WINDOWS\ or a directory with no php.ini after it then it hasent loaded one full stop and its just using the system defaults.

Ideally you want this to say C:\PHP\php.ini
0
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 

Author Comment

by:jeffreyscottsmith
ID: 17997458
Ok, it didn't work until I put things back.  However, it did show me that my PHP.ini is pointed to my winnt directory and there is no php.ini there.  Where is that path coming from?
0
 
LVL 13

Accepted Solution

by:
rhickmott earned 250 total points
ID: 17997536
Thats the default system path C:\WINNT\

If there is no

PHPIniDir

Specified then it will look in there first and you will find that if you dump php.ini in there then it will use it. The idea is though to keep it in the one location for simplicity which is why they introduced PHPIniDir.

According to http://www.php.net/manual/en/install.windows.apache2.php

The order is

LoadModule php5_module "c:/php/php5apache2.dll"                     ( 2_2.dll for you )
AddType application/x-httpd-php .php

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

Which would seem to confirm this.


I still think the extra
PHPIniDir "C:/www/php"

Will cause more problems as its basically setting a right value wrong value try commenting it out first and if PHP still works then delete it.
0
 

Author Comment

by:jeffreyscottsmith
ID: 17997682
ok, it works now. I kept the 1st instance and deleted the second.

Thanks.
0
 
LVL 13

Expert Comment

by:rhickmott
ID: 17997944
No Problem :)
0

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As Wikipedia explains 'robots.txt' as -- the robot exclusion standard, also known as the Robots Exclusion Protocol or robots.txt protocol, is a convention to prevent cooperating web spiders and other web robots from accessing all or part of a websit…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question