LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problem with PHP 4.3.4 and Apache2 (https://www.linuxquestions.org/questions/linux-newbie-8/problem-with-php-4-3-4-and-apache2-115680/)

Jeniva 11-13-2003 02:29 PM

Problem with PHP 4.3.4 and Apache2
 
Hello everyone,
First off, I wanted to say Great Forums!!! I have had many of my questions answered here.

Im a total n00b to linux, and im having a problem. I use RH9.

I downloaded/compiled(make)/and installed(make install) apache2 with no issues. (xxxx://24.167.164.149)
I then downloaded PHP-4.3.4, compiled/and installed it. I used the
./configure --with-mysql --with-apxs2=/usr/local/apache/bin/apxs command, and it went off with zero errors.

I added the "AddType application/x-httpd-php .php" (minus the "") to the httpd.conf line

and copied my php.ini to the /usr/local/lib/php.ini Directory

When I go to view my phpinfo.php, it wants me to download it. (24.167.164.149/phpinfo.php)

I made another .php file called test.php (24.167.164.149/test.php) and it shows up as a regular html file.

Anyone have any ideas??

I've been using linux for about 5 days now....so im really lost.

Looking_Lost 11-13-2003 03:41 PM

Do you have a line like

LoadModule php4_module modules/libphp4.so

in httpd.conf

Althjoug php added it automatically for me as far as I remember

rioguia 11-13-2003 03:49 PM

i'm struggling too but here are some suggestions for you to consider. i've been using step-by-step how-to's and most of these suggestions come from them? many of the answeres to these questions are probably recorded on your infophp.php file <?php
phpinfo();
?>

1. do you have a line in your httpd.conf like this?
LoadModule php4_module modules/libphp4.so

2. how are you loading your modules? For example --enable-dav option will build and include mod_dav and --enable-so will enable DSO (Dynamic Shared Object) support.

3. Did you modify your DirectoryIndex from

DirectoryIndex index.html

to

DirectoryIndex index.html index.php index.php4 default.htm

4. what are your permissions setting on your appache root document directory and your phpinfo.php file? for testing purposes you could just chmod -R 777 the whole root directory (this would be really bad in other than a test environment) if you want to eliminate this consideration in a hurry.

i hope this helps. i'll post back if i get my php-nuke online.

jogurt666 11-14-2003 03:15 AM

and what httpd do you use? i guess apache. if that is so

$ /configure --with-mysql--with-apache=../apache/source/dir --with-apxs2=/usr/local/apache/bin/apxs
$make
#make install

that will instal several fies in apache source code directory. than cd to apache source code directory and type:

$ ./configure --activate-module=src/modules/php4/libphp4.a
$make
#make install

after that you should add AddType (just as you did before) to httpd.conf, and start apache. everything should work fine now.

Jeniva 11-14-2003 12:51 PM

ok, thats kind of confusing me as I have no PHP4 in my modules directory under the apache2 directory.

jogurt666 11-15-2003 03:16 AM

well that is because you haven't compiled your apache to work with php. lets say that you have sources of both apache and php in the root directory. paths to them would be:

/root/php-4.3.4
/root/apache-1.3.28

you now have to cd into apache directory, and ./configure it. when you are done, you enter php directory and do the following things lets say that you have mysql under /usr/local/mysql:

$./configure --with-mysql=/usr/local/mysql --with-apache=../apache-1.3.28 --enable-track-vars

it is important to note that you give path to apache source not already installed apache!

$make
#make install

that installs php modules in /root/apache-1.3.28/src/modules/php4 and other required stuff, but lets focus on those modules installed in apache source dir. now all you have to do is to configure apache to use php4 module to do so, cd to apache source directory and configure it with the following option:

$./configure --activate-module=src/modules/php4/libphp4.a

where src/modules/php4 is source where all php modules are kept. now one more very important thing that confused me and many other people as i have found out. namely there is no libphp4.a file! it will be created during the compilation, so don't worry. and do not give path to libmodphp4.a instead! that will cause an error! after you just type:

$make
#make install

now just modify httpd.conf. don't forget to set register_globals = On in php.ini since it is disabled by default.
well i my case it works perfectly. i hope it will also do in yours.

Jeniva 11-15-2003 12:34 PM

k, i tried that

everything went fine until I got to the ./configure --activate-module=src/modules/php4/libphp4.a

I recieved this error:
Configure: Error: unrecognized option: --activate-module=src/modules/php4/libphp4.a


[EDIT: Even though I recieved that error, I can now view my phpinfo.php, so I guess its working, thanks!!!!!]

jogurt666 11-16-2003 03:57 AM

hmm well you shouldn't receive any errors. if you are afraid that those errors may disturb your further work, maybe download the following compilers: ANSI C, Bison, Gawk and Flex, and try compiling php and apache once again. php uses those compilers so that may override those errors.


All times are GMT -5. The time now is 12:51 AM.