• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 492
  • Last Modified:

PHP/Apache install on Linux

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
horganst
Asked:
horganst
  • 8
  • 6
  • 5
  • +3
1 Solution
 
a.marshCommented:
Create a script with just the following in it:

<?php

phpinfo();

?>


does that do anything?

Do bog standard HTML files display ok?

Ant
0
 
bobocacaCommented:
You might need to compile both together. Download the tarballs and read the readme file of php.
0
 
horganstAuthor Commented:
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
Industry Leaders: 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!

 
us111Commented:
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
 
horganstAuthor Commented:
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
 
a.marshCommented:
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
 
horganstAuthor Commented:
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
 
a.marshCommented:
Can I ask why you installed it as a static module?

Ant
0
 
horganstAuthor Commented:
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
 
us111Commented:
install it as DSO, it's more convenient
0
 
us111Commented:
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
 
a.marshCommented:
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
 
us111Commented:
with dso enable, you can add different modules later without recompiling apache
0
 
horganstAuthor Commented:
I'll try that later tonight, thanks.
MySQL is already there, that's the whole reason I'm doing this.
0
 
horganstAuthor Commented:
I'll try that later tonight, thanks.
MySQL is already there, that's the whole reason I'm doing this.
0
 
horganstAuthor Commented:
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
 
us111Commented:
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
 
horganstAuthor Commented:
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
 
sweatjeCommented:
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
 
MoondancerCommented:
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
 
a.marshCommented:
0 PAQ?

Ant
0
 
us111Commented:
split
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 8
  • 6
  • 5
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now