LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-21-2004, 03:38 AM   #1
3-1415
LQ Newbie
 
Registered: Jul 2004
Location: Kyiv
Distribution: Mandrake, ASP, Slackware, W2k
Posts: 19

Rep: Reputation: 0
Question My Apache2 fails to parse php-scripts in html pages


Hi ALL
My PHP scripts doesn't work under Apache2
I have Linux Mandrake 10.0 with Apache2 and PHP-4, installed from rpm-s.
I insert such a simple script:
<?php
echo "Hello!";
?>
in default page index.html and restart Apache.
But when I try to open the page, I cant see the string "Hello"
When I view the source of html code, I have my php code inside.
---------
In log file:
[warn] child process ####(process pid) still did not exit, Sending a SIGTERM
I have 10 such a messages per each restart. Next:
[notice] caught SIGTERM, shutting down
[notice] Digest: generating secret for digest authentication ...
[notice] Digest: done
[notice] Apache-AdvancedExtranetServer/2.0.48 (Mandrake Linux/5mdk) PHP/4.3.4 configured -- resuming normal operations
---------
After that Apache works fine except PHP scripts support

php.ini: remains untouchable
httpd2.ini:
AddType application/x-httpd-php .php
LoadModule php4_module extramodules/mod_php4.so


Is there anybody faced such a problem?
P.S. When I run a php-script from command line, everything works fine.
Thanks.
 
Old 10-21-2004, 04:05 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,215
Blog Entries: 1

Rep: Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067
Try to rename index.html to index.php so apache can parse it correctly
 
Old 10-21-2004, 04:27 AM   #3
3-1415
LQ Newbie
 
Registered: Jul 2004
Location: Kyiv
Distribution: Mandrake, ASP, Slackware, W2k
Posts: 19

Original Poster
Rep: Reputation: 0
Thanks, everything works fine!
Is there any way to make apache parse
php-scripts in documents with *.htm,*.html extension?
 
Old 10-21-2004, 04:39 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,215
Blog Entries: 1

Rep: Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067
You can do that by adding .htm .html in "AddType application/x-httpd-php .php" but then apache will parse all the plain html pages as php scripts.
 
Old 10-21-2004, 05:22 AM   #5
3-1415
LQ Newbie
 
Registered: Jul 2004
Location: Kyiv
Distribution: Mandrake, ASP, Slackware, W2k
Posts: 19

Original Poster
Rep: Reputation: 0
Smile

Quote:
Originally posted by bathory
You can do that by adding .htm .html in "AddType application/x-httpd-php .php" but then apache will parse all the plain html pages as php scripts.
As far as I know, apache parse the php code only between <?php ?> tags.
So is the working of apache will be more effective? If no where I mistaken.
Thank You in advance
 
Old 10-21-2004, 05:58 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,215
Blog Entries: 1

Rep: Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067Reputation: 2067
You're right, but if you add .htm .html to be parsed as php pages, then apache whenever is asked for a .htm page it will look every line of the page's code to see if it has php code in it, which has the effect to slow down it's operation.
 
Old 10-21-2004, 06:59 AM   #7
3-1415
LQ Newbie
 
Registered: Jul 2004
Location: Kyiv
Distribution: Mandrake, ASP, Slackware, W2k
Posts: 19

Original Poster
Rep: Reputation: 0
thank You, Your advices was helpful for me
bye...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Parse HTML using PHP jilljack Programming 1 11-07-2005 10:46 AM
Cookie Sharing Between CGI generated HTML pages and standard HTML pages rkwhited Linux - Newbie 5 08-15-2004 08:39 AM
parse HTML file and find keywords ? fnd Programming 8 06-09-2004 01:35 PM
php scripts return empty pages ararag Linux - Software 1 02-23-2004 11:46 AM
loading html pages with php BaudRacer Programming 3 12-03-2003 09:34 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:32 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration