Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linux/PHP setup ? 3

Status
Not open for further replies.

JaySang

Technical User
Jun 26, 2003
43
CA
I have been looking everywhere for documentation or anything to tell me how to setup php on my Linux Server.

I have apache 2.0.4 installed and it is running and tested. When i look at the httpd.conf, it includes the php.conf.

Where do I put the *.php files ?
Right now i'm trying them in the /var/ directories but it won't interpret and just shows the code.
Is there any further setup invlved ?

any help would be greatly apperciated
 
After trying to install the newest version of apache, i noticed that it wasn't loading the httpd.conf file from the /usr/local/apache2/conf/httpd.conf, it was locaing it from another area (somewhere in /etc/)using the older version of apache. This may be why php is not loading

Does anyone know why it would do this ?
 
You may have to rebuild php to work also.
Secondly, if this is index.php you are having problem with, then you need to edit the httpd.conf.
Look for line Directory Index and add index.php



>---------------------------------------Lawrence Feldman
SR. QA. Engineer SNAP Appliance
lfeldman@snapappliance.com

 
THe directory you are referring to is probably /etc/httpd/conf/httpd.conf

Just copy your new httpd.conf file there and apache should use it.
Next, make sure PHP is even installed on your machine. If you are sure it is, you can run it without apache just to make sure its executing properly by going to the directory where the file is located and typing:
php filename.php

If PHP is installed and the test program worked ok, then your problem is in your httpd.conf or the php.conf.
Look for these lines and add them if they are not there:
(Note this is for a Linux setup of an Apache 2 server)
In the httpd.conf file:
On the line that says DirectoryIndex add onto the list index.php

Look in the /etc/httpd/conf.d directory
Is there a php.conf file? If so check it to see whats been remarked out.

If it is not there create it and type this in:
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#

LoadModule php4_module modules/libphp4.so

#
# Cause the PHP interpreter handle files with a .php extension.
#
<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 524288
</Files>

#
# Add index.php to the list of files that will be served as directory
# indexes.
DirectoryIndex index.php





 
I installed a new version of apache 2.0.46. How can i tell if its the one thats running ? I was previously using 2.0.40 from the Redhat install.

I was trying to install php-4.3.2 i would get a file is truncated error.
So I downloaded php-4.3.1 and it came up with this error after install and trying to run httpd

&quot;apache2filter\sapi_apache2.c&quot;
is not compatible with this version of Apache

any suggestions i'm completely lost
 
Find where your Apache binary has been installed
find / -name &quot;httpd&quot;

Then run it from its path with this switch,
<where your httpd file is located>/httpd -v

You will see output like:
Server version: Apache/1.3.20 (Unix)
Server built: Jun 17 2002 14:09:06

Is it the one you are running?
What about when your system boots?

You will see all httpd binaries with the above query.
If you see more than one, then you know you are contending possibly with a vanilla install.
Find the one that is running now.
ps ax | grep httpd

That is probably the one you are looking for.
See what modules it is built with.
<path to your httpd>/httpd -l
Will give you something like:

Compiled-in modules:
http_core.c
mod_env.c
mod_log_config.c
mod_mime.c
mod_negotiation.c
mod_status.c
mod_include.c
mod_autoindex.c
mod_dir.c
mod_cgi.c
mod_asis.c
mod_imap.c
mod_actions.c
mod_userdir.c
mod_alias.c
mod_access.c
mod_auth.c
mod_so.c
mod_setenvif.c


Look for something like &quot;mod_php.c&quot;.

Your error:
&quot;apache2filter\sapi_apache2.c&quot;
is not compatible with this version of Apache


Tells me that you may have used an RPM for PHP/Apache that is not compatible with the version of Apache that you have installed.
You may need to download and use the correct version for the Apache installation that you are using.

 
Thanks for all you input everyone!!

I have it kinda working now. It interrepts the php, but whenever I load a php file that passes variables in the address line, it don't accept them. example\\
for some reason it doesn't want to take the variables in the address bar. I&quot;m fairly new to php, but passing variables works on my schools server

any help ?
 
Even though this if off-topic for this forum, I'll answer.
Your school's server probably has [tt]register_globals[/tt] set to [tt]on[/tt] and your code assumes this is true. However, the default for [tt]register_globals[/tt] changed to [tt]off[/tt] in PHP 4.2.0, hence it would be false on your home server.

//Daniel
 
To look at the difs between the two systems create a file called something like info.php and insert the following line only.

<? phpinfo() ?>

this will give you lots of things to check.
 
Just to add my 2c worth, I've got the same variable problem. Code works perfectly M$ box this register globals on and stops passing code when implemented on Linux system with register globals on. Both running Apache.

Just glad to here that I'm not the only person with this problem. :)
 
I had similar problems when upgrading a server from RH7.2 to RH8. The final gotcha, that meant some of my code no longer worked, was the setting of &quot;short_open_tag = off&quot; as the default in php.ini. This means that any script that uses the &quot;<?&quot; instead of &quot;<?php&quot; to indicate the start of php code would no longer work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top