Solved

PHP/Apache install on Linux

Posted on 2001-06-14
22
484 Views
Last Modified: 2008-02-01
I've installed PHP 4.0.5 and Apache 1.3.20 on my SuSE 7.0 Linux machine, but I cannot get any PHP scripts to display properly (they just show a blank page).

When I installed PHP, I installed using the static module method as described in the INSTALL file.

Once Apache and PHP were installed, I added the lines below to httpd.conf:

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

Can anyone help?
0
Comment
Question by:horganst
[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
  • 8
  • 6
  • 5
  • +3
22 Comments
 
LVL 15

Expert Comment

by:a.marsh
ID: 6193385
Create a script with just the following in it:

<?php

phpinfo();

?>


does that do anything?

Do bog standard HTML files display ok?

Ant
0
 

Expert Comment

by:bobocaca
ID: 6193518
You might need to compile both together. Download the tarballs and read the readme file of php.
0
 

Author Comment

by:horganst
ID: 6194388
I've tried the script above, no luck. And yes, HTML does work, just not any PHP portions within a HTML file.
I installed the two packages together according to the instructions in the PHP package.
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
LVL 8

Expert Comment

by:us111
ID: 6194671
have a look at your browser HTML source ,  do you see php script?
have you restart Apache ??

if you added AddType application/x-httpd-php .php you should have .php extension
0
 

Author Comment

by:horganst
ID: 6194694
I can see the php script in the HTML source, and I restarted Apache after editing the httpd.conf file. I tried calling it .php and .html, neither worked.

Do I have all the necessary lines in the httpd.conf file? Do I need to edit the php.ini file (in /usr/local/lib)?
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6194713
Obviously then the PHP script is not getting processed.......but why would it not be displayed in the browser window?

When ever I've had it where the script is not being processed, it gets displayed as part of the page..........

Ant
0
 

Author Comment

by:horganst
ID: 6194749
OK (I'm trying to remember now, since I'm in work and the Linux box is at home). When I try the phpinfo() script called phptest.php, it just appears as text in the browser. When I try to view a html page containing some php, the php is not processed and only the html displays.
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6194785
Can I ask why you installed it as a static module?

Ant
0
 

Author Comment

by:horganst
ID: 6194978
SuSE 7.0 came with Apache installed but it doesn't have PHP. So I got the tarball of PHP. When I installed PHP 4.0.5 as a dynamic module it didn't work, so I uninstalled the older Apache RPM and got the most recent tarball. Then I didn't see any other way to install other than the static method (I was using the documentation that came with PHP).
Any suggestions are welcome, I can even try reinstalling the older Apache RPM and doing a dynamic module install.
0
 
LVL 8

Expert Comment

by:us111
ID: 6194982
install it as DSO, it's more convenient
0
 
LVL 8

Expert Comment

by:us111
ID: 6194998
get rid of your rpm file

get the apache and php sources and compil them

cd apache-x...
./configure --prefix=/usr/local/apache  --enable-shared=max
make
make install

cd php4-x .
./configure  --with-apxs=/usr/local/apache/bin/apxs  ......and other options
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6195006
Exactly what I was going to suggest us111. :o)

That's why I was wondering the reasoning behind installing PHP as a static module.

horganst, I think you will find this very useful:

http://www.phpdeveloper.org/install1.php

And you might even want to consider installing MySQL aswell.

:o)

Ant
0
 
LVL 8

Expert Comment

by:us111
ID: 6195022
with dso enable, you can add different modules later without recompiling apache
0
 

Author Comment

by:horganst
ID: 6195023
I'll try that later tonight, thanks.
MySQL is already there, that's the whole reason I'm doing this.
0
 

Author Comment

by:horganst
ID: 6195035
I'll try that later tonight, thanks.
MySQL is already there, that's the whole reason I'm doing this.
0
 

Author Comment

by:horganst
ID: 6196751
OK here's exactly what I did:

cd /root/apache-1.3.20
./configure --prefix=/usr/local/apache --enable-shared=max
make
make install

cd /root/php-4.0.5
./configure --with-mysql --with-apxs=/usr/local/apache/bin/apxs
make
make install

cp php.ini-dist /usr/local/lib/php.ini

Then I edited httpd.conf and added 3 lines:

LoadModule php4_module libexec/libphp4.so
AddModule mod_php4.c
AddType application/x-httpd-php .php

...and tried to start Apache, but got this error:

Syntax error on line 222 of /usr/local/apache/conf/httpd.conf:
Cannot load /usr/local/apache/libexec/libphp4.so into server: /usr/local/apache/libexec/libphp4.so: cannot open shared object file: No such file or directory

So did the libphp4.so module get created at all !!?
0
 
LVL 8

Accepted Solution

by:
us111 earned 200 total points
ID: 6197894
check if libphp4.so is in /usr/local/apache/libexec/. The file has maybe another name. If it's the case rename it.

otherwise find the file on your disk and put it into  /usr/local/apache/libexec/

the file should be in /usr/local/src/php-4.0.5/libs/libphp4.so

in the directory  /usr/local/apache/libexec/ the file is maybe called modphp4.so or somehing like that, rename it
0
 

Author Comment

by:horganst
ID: 6198998
I could only find that file in /usr/lib/apache but it was created a few weeks ago.
Anyway I tried to use it and got this error:

Syntax error on line 222 of /usr/local/apache/conf/httpd.conf:
API module structure `php4_module' in file /usr/lib/apache/libphp4.so is garbled - perhaps this is not an Apache module DSO?
/usr/local/apache/bin/apachectl start: httpd could not be started

Nothing with a name similar to this exists in /usr/local/apache/libexec/
0
 
LVL 1

Expert Comment

by:sweatje
ID: 6240119
I use the following script to rebuild apache w/php.  It is for 1.3.14 but you should be able to tweak it.

mkdir apache
cd apache
rpm2cpio ../apache-1.3.14-2.6.2.src.rpm | cpio -i
tar xvzf apache_1.3.14.tar.gz
cd apache_1.3.14
cd src/modules/standard
mv ../../../../apache_1.3.14-rewritefix.patch .
patch -p1 < apache_1.3.14-rewritefix.patch
cd ../../..
for x in ../*.patch
do
     patch -p1 < $x
done
mv ../mod_bandwidth.c .
mv ../mod_put.c .
tar xvzf ../mod_throttle208.tgz
CFLAGS="-O2" LDFLAGS="-s" ./configure --prefix=/usr \
     --with-layout=RedHat \
     --add-module=mod_bandwidth.c \
     --add-module=mod_put.c \
     --activate-module=src/modules/throttle/mod_throttle.o \
     --enable-module=all \
     --disable-rule=WANTHSREGEX \
     --disable-module=auth_dbm \
     --with-perl=/usr/bin/perl \
     --enable-suexec \
     --suexec-docroot=/home/httpd/html \
     --suexec-caller=nobody
cd ../..
tar xvzf php-4.0.5.tar.gz
cd php-4.0.5
# Remove the "--with-pgsql" line below to disable PostgreSQL.
# Remove the "--with-sybase-ct" line below to disable Sybase support.
LDFLAGS="-s" CFLAGS="-O2 -I/usr/include/pgsql" ./configure --disable-debug \
     --with-system-regex \
     --enable-trans-sid \
     --with-gd \
     --with-jpeg-dir=/usr \
     --with-ttf \
     --enable-bcmath \
     --with-png-dir=../pdflib-4.0.0/png \
     --with-sybase-ct \
     --with-apache=../apache/apache_1.3.14
#     --with-sybase \
make
make install
cd ../apache/apache_1.3.14
CFLAGS="-O2" LDFLAGS="-s" ./configure --prefix=/usr \
     --with-layout=RedHat \
     --add-module=mod_bandwidth.c \
     --add-module=mod_put.c \
     --activate-module=src/modules/throttle/mod_throttle.o \
     --enable-module=all \
     --disable-rule=WANTHSREGEX \
     --disable-module=auth_dbm \
     --with-perl=/usr/bin/perl \
     --enable-suexec \
     --suexec-docroot=/home/httpd/html \
     --suexec-caller=nobody \
     --activate-module=src/modules/php4/libphp4.a
#     --activate-module=src/modules/php3/libphp3.a
make


Although I have tweaked to suit my need, the original author of this script was Charles Fisher (www.rhadmin.org) and is available in his book RedHat Linux Administration Tools.  This book also contains an excellent walkthrough of installing sybase.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6419182
It's time to clean up this topic area and that means taking care of this question. Your options at this point are:

1. Award points to the Expert who provided an answer, or who helped you most. Do this by clicking on the "Accept Comment as Answer" button that lies above and to the right of the appropriate expert's name.

2. PAQ the question because the information might be useful to others, but was not useful to you. To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

3.  Ask Community Support to help split points between participating experts.  Just comment here with details.

4.  Delete the question because it is of no value to you or to anyone else.  To use this option, you must state why the question is no longer useful to you, and the experts need to let me know if they feel that you're being unfair.

If you elect for option 2, 3 or 4, just post comment with details here and I'll take it from there.  We also request that you review any other open questions you might have and update/close them.  Display all your question history from your Member Profile to view details.

PLEASE DO NOT AWARD THE POINTS TO ME.

____________________________________________



Hi Experts:

In the event that the Asker does not respond, I would very much appreciate your opinions as to which Expert ought to receive points (if any) as a result of this question.  Likewise, you can also suggest that I PAQ or delete the question.

Experts, please do not add further "answer" information to this question.  I will be back in about one week to finalize this question.

Thank you everyone.

Moondancer :)
Community Support Moderator @ Experts Exchange

P.S.  REGARDING POINTS, Guidelines and more:  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp  
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6420008
0 PAQ?

Ant
0
 
LVL 8

Expert Comment

by:us111
ID: 6420956
split
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
migrating to phpbb forum from vBulletin 4.2 3 87
restriction of entering a a page 5 44
Dump data from mysql to xls php 10 49
integrated two Separate file . 3 21
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

742 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