Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

I cannot get php scripts to work in Apache.

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Next:  Cannot load my webpage from another PC  
Author Message
ljones

External


Since: Oct 02, 2004
Posts: 5



(Msg. 1) Posted: Sat Oct 02, 2004 4:58 pm
Post subject: I cannot get php scripts to work in Apache.
Archived from groups: alt>apache>configuration (more info?)

I cannot get php scripts to work in Apache.

Apache 2.0.52 and PHP 5.0.2 installed on XP Pro SP2 Box.

PHP works fine from the command line, in any directory.

Apache works fine serving straight .htm and .html content, but ignores
everything between <?php and ?>. For instance http://len.net/php.htm
returns

Hi there
Bye

where php.htm consists of:

<HTML>
<HEAD>
<TITLE>Hello World</TITLE>
</HEAD>
<BODY>
Hi there<p>
<?PHP
echo "PHP works";
?>
Bye<p>
</BODY>
</HTML>

Part of httpd.conf follows:

ServerName len.net:80
DocumentRoot "C:/Dev Web/Local"

LoadModule access_module modules/mod_access.so
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_module modules/mod_auth.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule imap_module modules/mod_imap.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule userdir_module modules/mod_userdir.so

## I've tried the following:
#LoadModule php5_module c:/Program Files/php/php5apache2.dll
# but Apache refused to start and reported an error at the line

Any help, references, clues, or advice would be welcome.

Len Jones

 >> Stay informed about: I cannot get php scripts to work in Apache. 
Back to top
Login to vote
kalvaronospamt

External


Since: Feb 25, 2004
Posts: 58



(Msg. 2) Posted: Sun Oct 03, 2004 12:18 am
Post subject: Re: I cannot get php scripts to work in Apache. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

*** Len Jones escribió/wrote (Sat, 2 Oct 2004 13:58:40 -0400):
 > I cannot get php scripts to work in Apache.
 >
 > Apache 2.0.52 and PHP 5.0.2 installed on XP Pro SP2 Box.
 >
 > PHP works fine from the command line, in any directory.
 >
 > Apache works fine serving straight .htm and .html content, but ignores
 > everything between <?php and ?>. For instance <a style='text-decoration: underline;' href="http://len.net/php.htm" target="_blank">http://len.net/php.htm</a>
 > returns

Right... You seem to need two things: make PHP work and make Apache parse
PHP in all HTML files. Try to make them one by one. Do *.php files work as
expected?


--
-+ Álvaro G. Vicario - Burgos, Spain
+- <a style='text-decoration: underline;' href="http://www.demogracia.com" target="_blank">http://www.demogracia.com</a> (la web de humor barnizada para la intemperie)
++ Las dudas informáticas recibidas por correo irán directas a la papelera
-+ I'm not a free help desk, please don't e-mail me your questions
--<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: I cannot get php scripts to work in Apache. 
Back to top
Login to vote
ljones

External


Since: Oct 02, 2004
Posts: 5



(Msg. 3) Posted: Sun Oct 03, 2004 12:18 am
Post subject: Re: I cannot get php scripts to work in Apache. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Alvaro G. Vicario" <kAlvaroNOSPAMTHANKS RemoveThis @terra.es> wrote in message
news:1b80zcodfl33l.zffjr0heqi1q$.dlg@40tude.net...
 > *** Len Jones escribió/wrote (Sat, 2 Oct 2004 13:58:40 -0400):
  >> I cannot get php scripts to work in Apache.
  >>
  >> Apache 2.0.52 and PHP 5.0.2 installed on XP Pro SP2 Box.
  >>
  >> PHP works fine from the command line, in any directory.
  >>
  >> Apache works fine serving straight .htm and .html content, but ignores
<font color=green>  >> everything between <?php and ?>. For instance <a style='text-decoration: underline;' href="http://len.net/php.htm</font" target="_blank">http://len.net/php.htm</font</a>>
  >> returns
 >
 > Right... You seem to need two things: make PHP work and make Apache parse
 > PHP in all HTML files. Try to make them one by one. Do *.php files work as
 > expected?

Thanks for the response. No *.php files don't work.

Running IE; I get a message box that says,
'Do you want to save this file',

Running Mozilla; I get a message box that says,
'The file php.php is of type application/x-httpd-php, and Mozilla does
not know how to handle this file type. This file is located at
<a style='text-decoration: underline;' href="Http://len.net/" target="_blank">Http://len.net/</a>

What should Mozilla do with this file?

0 Open it with the default appication
0 Open it with [ edit line ]
0 Save it to disk'


Len Jones<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: I cannot get php scripts to work in Apache. 
Back to top
Login to vote
dinges_danges_

External


Since: Aug 03, 2004
Posts: 88



(Msg. 4) Posted: Sun Oct 03, 2004 4:15 am
Post subject: Re: I cannot get php scripts to work in Apache. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Len Jones said the following on 02/10/2004 19:58:

[snip]
 > where php.htm consists of:
 >
 > <HTML>
 > <HEAD>
 > <TITLE>Hello World</TITLE>
 > </HEAD>
 > <BODY>
 > Hi there<p>
 > <?PHP
 > echo "PHP works";
 > ?>
 > Bye<p>
 > </BODY>
 > </HTML>

Unless you've explicitely told Apache to parse htm as php files, it's no
surprise that you only get:

Hi there
Bye

 > Part of httpd.conf follows:
[snip]
 > ## I've tried the following:
 > #LoadModule php5_module c:/Program Files/php/php5apache2.dll
 > # but Apache refused to start and reported an error at the line

It will most likely help if you provide the error you get. By not
loading the php module, it's no wonder that it doesn't work.

--
Regards
Harrie<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: I cannot get php scripts to work in Apache. 
Back to top
Login to vote
ljones

External


Since: Oct 02, 2004
Posts: 5



(Msg. 5) Posted: Sun Oct 03, 2004 10:42 am
Post subject: Re: I cannot get php scripts to work in Apache. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Harrie" <dinges_danges_donges DeleteThis @hotmail.com> wrote in message
news:415f36a6$0$48933$e4fe514c@news.xs4all.nl...
 > Len Jones said the following on 02/10/2004 19:58:
 >
 > [snip]
  >> where php.htm consists of:
  >>
  >> <HTML>
  >> <HEAD>
  >> <TITLE>Hello World</TITLE>
  >> </HEAD>
  >> <BODY>
  >> Hi there<p>
  >> <?PHP
  >> echo "PHP works";
  >> ?>
  >> Bye<p>
  >> </BODY>
  >> </HTML>
 >
 > Unless you've explicitely told Apache to parse htm as php files, it's no
 > surprise that you only get:
 >
 > Hi there
 > Bye

Hi Harrie,

How do I tell Apache to parse htm as php files. What am I not doing, or
doing wrong?


  >> Part of httpd.conf follows:
 > [snip]
  >> ## I've tried the following:
  >> #LoadModule php5_module c:/Program Files/php/php5apache2.dll
  >> # but Apache refused to start and reported an error at the line
 >
 > It will most likely help if you provide the error you get.

There were 4 error messages:
1) A window opened saying:
Windows could not start the Apache2 on Local Computer. For more
information, review the System Event log. If this is a non-Microsoft
service, contact the vendor, and refer to service-specific error code 1.

2) Event Viewer/System contained the following message:
Type: Error. The Apache2 service terminated with service-specific error 1
(0x1).

Event Viewer/Application contains the following 2 messages:
3) Type: Error. The Apache service named reported the following error:
   >>> Syntax error on line 197 of C:/Program Files/Apache
   >>> Group/Apache2/conf/httpd.conf: .

Event ID 4399
4) Type: Error. The Apache service named reported the following error:
   >>> LoadModule takes two arguments, a module name and the name of a shared
   >>> object file to load it from .

 > By not loading the php module, it's no wonder that it doesn't work.

Which module do I load? I have 48 modules of the form */Apache
Group/Apache2/mod_*.so, and none of them seems relevant.
How do I use c:/Program Files/php/php5apache2.dll if that is the appropriate
thing to do?


Hoping you can provide the answer.

Len Jones<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: I cannot get php scripts to work in Apache. 
Back to top
Login to vote
dinges_danges_

External


Since: Aug 03, 2004
Posts: 88



(Msg. 6) Posted: Sun Oct 03, 2004 5:44 pm
Post subject: Re: I cannot get php scripts to work in Apache. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Len Jones said the following on 03/10/2004 13:42:

 > "Harrie" <dinges_danges_donges.TakeThisOut@hotmail.com> wrote in message
 > news:415f36a6$0$48933$e4fe514c@news.xs4all.nl...
 >
  >>Len Jones said the following on 02/10/2004 19:58:
 >
 > How do I tell Apache to parse htm as php files. What am I not doing, or
 > doing wrong?

I don't think you should, but changing the extention to .php might help.
But since you don't load the module, you should fix that first.

   >>>## I've tried the following:
   >>>#LoadModule php5_module c:/Program Files/php/php5apache2.dll
   >>># but Apache refused to start and reported an error at the line
  >>
  >>It will most likely help if you provide the error you get.
 >
 > There were 4 error messages:

[snipped three Windows messages]

 > Event ID 4399
 > 4) Type: Error. The Apache service named reported the following error:
 >
   >>>>LoadModule takes two arguments, a module name and the name of a shared
   >>>>object file to load it from .

I've never used Apache on a Windows platform, but I think you should put
the path to the module in quotes, so it will see it as *one* argument.

So try:

LoadModule php5_module "c:/Program Files/php/php5apache2.dll"

  >>By not loading the php module, it's no wonder that it doesn't work.
 >
 > Which module do I load? I have 48 modules of the form */Apache
 > Group/Apache2/mod_*.so, and none of them seems relevant.

The php module offcourse. The one you commented out and where I
responded to (and which is called "module" in your httpd.conf).

 > How do I use c:/Program Files/php/php5apache2.dll if that is the appropriate
 > thing to do?

Yes it is, try quoting it.

I don't use PHP myself and I'm not familiar with it's documentation, but
I'm convinced it's in there.

--
Regards
Harrie<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: I cannot get php scripts to work in Apache. 
Back to top
Login to vote
ljones

External


Since: Oct 02, 2004
Posts: 5



(Msg. 7) Posted: Sun Oct 03, 2004 5:44 pm
Post subject: Re: I cannot get php scripts to work in Apache. [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"Harrie" <dinges_danges_donges RemoveThis @hotmail.com> wrote in message
news:415ff44e$0$25965$e4fe514c@news.xs4all.nl...
 >
 > I've never used Apache on a Windows platform, but I think you should put
 > the path to the module in quotes, so it will see it as *one* argument.
 >
 > So try:
 >
 > LoadModule php5_module "c:/Program Files/php/php5apache2.dll"

Thank you Harrie. It works.

Len Jones<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: I cannot get php scripts to work in Apache. 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Perl scripts on apache - Hi. I have windows 2000 and red hat linux 9 running on my machine. I have a local site that I would like to visit in both OSes. The problem is that it has perl scripts which run OK in windows, but when i boot to linux I just cant get them to work. The..

CGI scripts: What has changed between Apache A.3 and Apach.. - Hi, I have a few CGI scripts that worked fine under mandrake 8.1 and apache 1.3.?, but having UPGRADED (ie not a new installation) to Mandrake 9.1 and Apache 2.0, I keep on getting a 'file not found' error whwn I run the scripts - in..

Adding support for CGI scripts in Apache - How is the support for CGI script configured in Apache? I read about a lot of parameters: - AddHandler - ScriptAlias - Option ExecCGI - AddModule for cgi Or is it all in combination??? Can I get some documentation detailing all this (without creating..

REXX cgi scripts with Apache under Win2K - I'm trying to convert a lot of stuff I ran under OS/2 to Windows 2000 and slowly but surely I'm getting there. One of the biggest sticking points is all of the REXX cgi I had written. REXX is native to OS/2, but it's an add-on for Windows 2000. I..

Newbie - help in getting CGI scripts working under Apache - Hello, I'm currently running Red Hat 9 with Apache 2.0.40. I'm trying to configure my system so that I can build and test my website on my own machine, before posting everything online. Also, because I'm not very knowledgeable with using Perl, it give...
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]