Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

PHP won't serve page

Posted on 2006-11-21
7
Medium Priority
?
322 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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 

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 1000 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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

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…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

688 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