PHP Configuration

A

Anonymous

Guest
:shock: I think I have the PHP engine installed and working but can not tell. Somehow everytime I try to view a file, the browser (tried FireFox, NetScape and MSIE) thinks the file is a script or something and prompts for a "Download" instead of showing the page. When a page does show it does not interpret, but shows just text.

I went to the MS Explorer, looked at the Filetypes supported and found that .PHP is set to "PHP Script File" and assigned to open with the browser, but still cannot get the browser to work with the file.

The reason I know these files are good is I had them working before on/from a web site, but can't make them work with the Apache/PHP local host. I'm wondering if I still need a tweak or two on the Apache config.

Does anyone no the answer to my problem?
 
this becuase you have not configured Apache to handle php script

read php's install.txt (apache configuratiion)

you need to do

AddType and LoadModule directives....
 
:? I actually have the following config in the httpd.conf file:

AddType text/html .htm .dhtml .html .shtml .php .xml
AddOutputFilter INCLUDES .dhtml .shtml .php
AddHandler server-parsed .dhtml .shtml .html .htm .xml .php

I used to have:

#AddType application/x-httpd-php php
#ScriptAlias /_php/ "E:\Program Files\PHP Server"
#ScriptAlias /php/ "E:\Program Files\PHP Server"
#AddType application/x-httpd-php "/_php/php.exe"
#AddHandler php-script .php

but it behaved so badly that I had to take it out. The path is correct, the files actully do exist on the "E:" drive. Should I assume that I do need a "ScriptAlias" but have the syntax wrong?

OMR
 
8) What about these lines:

#ScriptAlias /_php/ "E:\Program Files\PHP Server"
#ScriptAlias /php/ "E:\Program Files\PHP Server"
#AddType application/x-httpd-php "/_php/php.exe"
#AddHandler php-script .php

I had a book on PHP (don't remember the title or author) that gave me those lines. They seemed to cause more problems than they solved. Should I use any of them?
 
:? Un commented and edited the line you replied about. Did a restart on Apache and checked again.

I even have a test.html file I am testing with which is:

<html>
<body>
<?
phpinfo();
?>
</html>
<?
echo <h1><b>It works!</b></h1>
<br>Test again!
phpinfo();
?>
</body>
</html>

All it shows in the "It works!" in bold and all that follows shows as text.

I think one of the ScriptAlias lines (maybe both) is needed to actually call the PHP engine, but I don't know what actual syntax to use.

I'm wondering if:

ScriptAlias /.php/ "E:\Program Files\PHP Server"
ScriptAlias .php/ "E:\Program Files\PHP Server"

is what it is looking for?

OMR
 
hi,
please check on the following points
  • Check for your php4ts.dll file location (read the php INSTALL.txt)
  • Check for the LoadModule and AddModule configuration in Apache (read the php INSTALL.txt for Apache Configuration as shared module)
  • Check the AddType configuration for Apache (read the php INSTALL.txt for Apache Configuration as shared module)

first check on those....
still if you have a problem,,,, help is a post away ... :)
 
:help: First so you will know here are all the commands in my config file:

# Server Side Processing Configuration
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
AddType text/html .htm .dhtml .html .shtml .php .xml
AddOutputFilter INCLUDES .dhtml .shtml .php
AddHandler server-parsed .dhtml .shtml .html .htm .xml .php

# Enable the PHP Server
#LoadModule php4_module "E:\Program Files\PHP Server\php.exe"
#LoadModule php4_module "E:\Program Files\PHP Server\php4ts.dll"
#LoadModule php4_module "E:\Program Files\PHP Server\sapi\php4apache.dll"
#AddModule mod_php4.c

AddHandler php-script .php
AddType application/x-httpd-php .php
#AddType application/x-httpd-php "/_php/php.exe"
#ScriptAlias /_php/ "E:\Program Files\PHP Server\php.exe"
#ScriptAlias /php/ "E:\Program Files\PHP Server\php.exe"
#ScriptAlias /._php/ "E:\Program Files\PHP Server\php.exe"
#ScriptAlias /.php/ "E:\Program Files\PHP Server\php.exe"

I ran the "php.exe -i" test from the Install.txt file. It ran OK

Then as I added the "LoadModule" and "AddModule" commands, one at a time,
running "RESTART" after each; I got errors on each.

If you can explain the relationship, dependencies, etc., which I cannot find
in any books or help files, then maybe debugging will be easier. Right now
I'm clueless!
 
What version of Apache are you running? If you're running >2, try removing the AddHandler line.
 
AddHandler server-parsed .dhtml .shtml .html .htm .xml .php
why are you adding server-parsed handler to php...
it should be separate...
remove that .php handler

then use LoadModule, AddModule, AddType...
and then check
 
OldManRiver said:
:help: First so you will know here are all the commands in my config file:

# Server Side Processing Configuration
# To parse .shtml files for server-side includes (SSI):
# (You will also need to add "Includes" to the "Options" directive.)
#
AddType text/html .htm .dhtml .html .shtml .php .xml
AddOutputFilter INCLUDES .dhtml .shtml .php
AddHandler server-parsed .dhtml .shtml .html .htm .xml .php

# Enable the PHP Server
#LoadModule php4_module "E:\Program Files\PHP Server\php.exe"
#LoadModule php4_module "E:\Program Files\PHP Server\php4ts.dll"
#LoadModule php4_module "E:\Program Files\PHP Server\sapi\php4apache.dll"
#AddModule mod_php4.c

AddHandler php-script .php
AddType application/x-httpd-php .php
#AddType application/x-httpd-php "/_php/php.exe"
#ScriptAlias /_php/ "E:\Program Files\PHP Server\php.exe"
#ScriptAlias /php/ "E:\Program Files\PHP Server\php.exe"
#ScriptAlias /._php/ "E:\Program Files\PHP Server\php.exe"
#ScriptAlias /.php/ "E:\Program Files\PHP Server\php.exe"

I ran the "php.exe -i" test from the Install.txt file. It ran OK

Then as I added the "LoadModule" and "AddModule" commands, one at a time,
running "RESTART" after each; I got errors on each.

If you can explain the relationship, dependencies, etc., which I cannot find
in any books or help files, then maybe debugging will be easier. Right now
I'm clueless!
try this:
# First load PHP as module
LoadModule php4_module "E:\Program Files\PHP server\sapi\php4apache.dll
# or
# LoadModule php4_module "E:\Program Files\PHP server\sapi\php4apache2.dll
# for apache 2.0.x

# Second, PHP extension initialization
AddType application/x-httpd-php .php

# And only after that add handler
AddHandler php-script .php

P.S.
Then Apache start it's like BASIC interpretetor read each string from top to down.
and once more remove PHP from this line: AddType text/html .htm .dhtml .html .shtml .php .xml
cuz Apache first think what php extension is simple HTML file
Good luck
 
I never got errors before now with the code:

LoadModule php4_module "E:\Program Files\PHP Server\sapi\php4apache.dll"
AddType application/x-httpd-php .php
AddHandler php-script .php

I'm getting this error:

Syntax error on line 815 of E:/Program Files/Apache Group/Apache2/conf/httpd.con
f:
Cannot load E:/Program Files/PHP Server/sapi/php4apache.dll into server: One of
the library files needed to run this application cannot be found.

Sorry I'm so clueless on this!
 
So what am I missing here? I'm clueless, as I still have not idea or understanding of intedepencies and operational modes, so need the help.

Thanks in advance!

OMR
 
This should work:
Code:
    ScriptAlias /php/ "c:/php/"
    AddType application/x-httpd-php .php
    Action application/x-httpd-php "/php/php.exe"
If PHP is not installed in C:/PHP, just change the code so it points to the correct directory.
 
OldManRiver said:
I never got errors before now with the code:

LoadModule php4_module "E:\Program Files\PHP Server\sapi\php4apache.dll"
AddType application/x-httpd-php .php
AddHandler php-script .php

I'm getting this error:

Syntax error on line 815 of E:/Program Files/Apache Group/Apache2/conf/httpd.con
f:
Cannot load E:/Program Files/PHP Server/sapi/php4apache.dll into server: One of
the library files needed to run this application cannot be found.

Sorry I'm so clueless on this!
What exactly on the page 815?
 
What it is referring to is Line (not page) 815, which is:

LoadModule php4_module "E:\Program Files\PHP Server\sapi\php4apache.dll"

in the Apache Config file.

I'm thinking the real errors are in the PHP config file, but not sure. The previous persons helping me had me change the PHP config file as well, so thinking that is the source of the problem.

Do you know?

OMR
 
are you on Windows? in that case you might need to copy that dll file to Windows folder as well: or add a path to PHP folder into the PATH enviromental variable
 
Back
Top