Click to See Complete Forum and Search --> : this is really getting absurd...


sivel
02-08-2003, 12:36 PM
hello all!

heres the prob im having:

im runnnig php4 [latest], and aache 2.0 on a mandrake 9.0 box.
i installed the above during the install of linux.
the problem is php isnt recognising .php.
ive searched the forums, read the manual, edited my php.in as well as my httpd.conf, and finally reverted back to my original .conf files [thank god for backups].
when i goto my /var/www/html/addon-modules/mod_php,
thers a file in there called PHP_FAQ.php. i open it with mozilla and great-no prob. any other .php file on my system opens up to the "code" that it was written with in output.ive assumed that i php is installed correctly, you can open any .php file on yer comp.
im banging my head against the wall on this on, someone plz help. also, its the same shpiel on my other 3 freshly installed linux boxes.

thanx in advance,
sivel:D

PAEricksen
02-09-2003, 02:17 AM
this may seem stupid and I'm just a newbie,

but you are including


<?php

some php code here

?>


in your .php files aren't you?

sivel
02-09-2003, 01:58 PM
actually,
the .php files that im trying to open are coded by guys who know what theyre doing. and all the files i try to open have the correct "tags" this is gonna drive me to insanity.

thanks,
sivel

KilerCris
02-09-2003, 02:16 PM
I had a similar problem. Mandrake comes with PHP with the short_open_tags setting set to off. This means that only files like


<?php

blah();

?>


will be parsed.

Most of your script probably only use


<?

blah();

?>


Just set short_open_tag to 'On' in php.ini (/etc/php.ini) and restart apache. Hope the helps.

sivel
02-09-2003, 08:57 PM
<?php

blah();

?>

thats exactly the types of scripts i'm trying to open and, in the php.ini, those tags are allowed as well as the other short tags and asp tags you showed me in your example. In that respect it seems as though for the most part everything in the php.ini is set correctly, i.e. all the "load modules" and "add modules" are pointing to the correct directerites.


thanks
sivel:D

sivel
02-10-2003, 10:16 AM
anybody? any other suggestions?

Hayl
02-10-2003, 10:29 AM
I know you said you edited your httpd.conf but just ot double-check; Make sure you have this stuff.

LoadModule php4_module /usr/lib/apache/1.3/libphp4.so

(obviously yours would be slightly different as you are using apache 2.)


#
# And for PHP 4.x, use:
#
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps


<IfModule mod_dir.c>
DirectoryIndex index.html index.php3 index.htm index.shtml index.cgi index.php
</IfModule>

goon12
02-10-2003, 11:11 AM
Make sure you do this too:

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


Alot of people forget this step and have the same problem your having.

-goon12

sivel
02-10-2003, 11:50 AM
heythere!

well, im gonna pretty much be doing this from work, telneting in,
so i have a few questions:

in regards to hayl first line of code:
got that in already,

"" " " second line of code:
i have those lines in my php.conf, which at the very bottom of the httpd.conf it says: include conf/addon-modules/php.conf, which it is pointing in the right dir.


under my AddModules section, the very first line says "ClearModuleList" --doesnt sound good.

in regards to the comment about the dir index, thats nowhere to be found in my httpd.conf, however it is in my commonhttpd.conf,
which is "included" towards the middle of the httpd.conf, but without the "<ifModule mod_dir.c> tags.

lastly, the comment about copying the php.ini-dist file, where exactly would that file be located?


thanks for the help,
sivel

sivel
02-10-2003, 11:53 AM
let me ask you,

does it make a dfference whether or not those lines are in the actual httpd.conf, or if they are in other config files and included
in the main httpd.conf?


thanx,
sivel

sivel
02-10-2003, 12:03 PM
### Main Configuration Section
### You really shouldn't change these settings unless you're a guru
###
ServerType standalone
ServerRoot /etc/httpd
#ServerName localhost
#LockFile /etc/httpd/httpd.lock
PidFile /var/run/httpd.pid
ScoreBoardFile /etc/httpd/httpd.scoreboard
ErrorLog logs/error_log
LogLevel warn
ResourceConfig /dev/null
AccessConfig /dev/null
DocumentRoot /var/www/html


### Dynamic Shared Object (DSO) Support
###
###
#LoadModule mmap_static_module modules/mod_mmap_static.so
LoadModule env_module modules/mod_env.so
LoadModule config_log_module modules/mod_log_config.so
LoadModule agent_log_module modules/mod_log_agent.so
LoadModule referer_log_module modules/mod_log_referer.so
#LoadModule mime_magic_module modules/mod_mime_magic.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule status_module modules/mod_status.so
LoadModule info_module modules/mod_info.so
LoadModule includes_module modules/mod_include.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule dir_module modules/mod_dir.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule asis_module modules/mod_asis.so
LoadModule imap_module modules/mod_imap.so
LoadModule action_module modules/mod_actions.so
#LoadModule speling_module modules/mod_speling.so
LoadModule userdir_module modules/mod_userdir.so
LoadModule proxy_module modules/libproxy.so
LoadModule alias_module modules/mod_alias.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule access_module modules/mod_access.so
LoadModule auth_module modules/mod_auth.so
LoadModule anon_auth_module modules/mod_auth_anon.so
#LoadModule dbm_auth_module modules/mod_auth_dbm.so
#LoadModule db_auth_module modules/mod_auth_db.so
LoadModule digest_module modules/mod_digest.so
#LoadModule cern_meta_module modules/mod_cern_meta.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule usertrack_module modules/mod_usertrack.so
#LoadModule example_module modules/mod_example.so
#LoadModule unique_id_module modules/mod_unique_id.so
LoadModule setenvif_module modules/mod_setenvif.so
<IfDefine HAVE_PHP4>
LoadModule php4_module extramodules/libphp4.so
</IfDefine>
<IfDefine HAVE_SSL>
LoadModule ssl_module extramodules/libssl.so
</IfDefine>
<IfDefine HAVE_SXNET>
LoadModule sxnet_module extramodules/mod_sxnet.so
</IfDefine>
LoadModule vhost_alias_module modules/mod_vhost_alias.so

# Reconstruction of the complete module list from all available modules
# (static and shared ones) to achieve correct module execution order.
# [WHENEVER YOU CHANGE THE LOADMODULE SECTION ABOVE UPDATE THIS, TOO]
ClearModuleList
#AddModule mod_mmap_static.c
AddModule mod_env.c
AddModule mod_log_config.c
AddModule mod_log_agent.c
AddModule mod_log_referer.c
#AddModule mod_mime_magic.c
AddModule mod_mime.c
AddModule mod_negotiation.c
AddModule mod_status.c
AddModule mod_info.c
AddModule mod_include.c
AddModule mod_autoindex.c
AddModule mod_dir.c
AddModule mod_cgi.c
AddModule mod_asis.c
AddModule mod_imap.c
AddModule mod_actions.c
#AddModule mod_speling.c
AddModule mod_userdir.c
AddModule mod_proxy.c
AddModule mod_alias.c
AddModule mod_rewrite.c
AddModule mod_access.c
AddModule mod_auth.c
AddModule mod_auth_anon.c
#AddModule mod_auth_dbm.c
#AddModule mod_auth_db.c
AddModule mod_digest.c
#AddModule mod_cern_meta.c
AddModule mod_expires.c
AddModule mod_headers.c
AddModule mod_usertrack.c
#AddModule mod_example.c
#AddModule mod_unique_id.c
AddModule mod_so.c
AddModule mod_setenvif.c
<IfDefine HAVE_PHP4>
AddModule mod_php4.c
</IfDefine>
<IfDefine HAVE_SSL>
AddModule mod_ssl.c
</IfDefine>
<IfDefine HAVE_SXNET>
AddModule mod_sxnet.c
</IfDefine>
AddModule mod_vhost_alias.c

###
### Global Configuration
###
# We now support multiple apache configurations on the same server. In
# common.conf, we put all directives that are common to all implementations
# (httpd, httpd-perl, etc.)
Include conf/commonhttpd.conf


###
### IP Address/Port and Proxied configuration section
###
# The APACHEPROXIED setting can be set in /etc/rc.d/init.d/httpd if you
# are using a proxy or accelerator, like the Apache-SGI or khttpd, so that
# the fast web server serves static content while Apache handles the
# cgi or php files

#BindAddress *
<IfDefine APACHEPROXIED>
Port 8080
Listen 8080
</IfDefine>
<IfDefine !APACHEPROXIED>
Port 80
Listen 80
</IfDefine>

# Likewise, we can set apache as the server by default and send perl
# requests via ProxyPass to apache-mod_perl. It increases performance
# since the perl interpreter is only used for perl and the standard apache
# does all the html and image files, with a smaller footprint.
#
# If you install apache and apache-mod_perl, this is the default config.
# If you don't want two web servers to use perl, uninstall apache, and
# apache-mod_perl will not be proxied.

<IfDefine PERLPROXIED>
RewriteEngine on
RewriteRule ^proxy:.* - [F]
RewriteRule ^(.*\/perl\/.*)$ http://%{HTTP_HOST}:8200$1 [P]
RewriteRule ^(.*\/cgi-perl\/.*)$ http://%{HTTP_HOST}:8200$1 [P]
</IfDefine>

###
### Log configuration Section
###

#Single logfile with access, agent and referer information
#This is the default, if vlogs are not defined for the main server
CustomLog logs/access_log combined env=!VLOG
#If VLOG is defined in conf/vhosts/Vhost.conf, we use this entry
CustomLog "|/usr/sbin/advxsplitlogfile" vhost env=VLOG


###
### Virtual Hosts
###
# We include different templates for Virtual Hosting. Have a look in the
# vhosts directory and modify to suit your needs.
Include conf/vhosts/Vhosts.conf
#Include conf/vhosts/DynamicVhosts.conf
#Include conf/vhosts/VirtualHomePages.conf


###
### Performance settings Section
###
#
# Timeout: The number of seconds before receives and sends time out.
#
Timeout 300

#
# KeepAlive: Whether or not to allow persistent connections (more than
# one request per connection). Set to "Off" to deactivate.
#
KeepAlive On

#
# MaxKeepAliveRequests: The maximum number of requests to allow
# during a persistent connection. Set to 0 to allow an unlimited amount.
# We recommend you leave this number high, for maximum performance.
#
MaxKeepAliveRequests 100

#
# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15

#
# Server-pool size regulation. Rather than making you guess how many
# server processes you need, Apache dynamically adapts to the load it
# sees --- that is, it tries to maintain enough server processes to
# handle the current load, plus a few spare servers to handle transient
# load spikes (e.g., multiple simultaneous requests from a single
# Netscape browser).
#
# It does this by periodically checking how many servers are waiting
# for a request. If there are fewer than MinSpareServers, it creates
# a new spare. If there are more than MaxSpareServers, some of the
# spares die off. The default values are probably OK for most sites.
#
MinSpareServers 4
MaxSpareServers 10

#
# Number of servers to start initially --- should be a reasonable ballpark
# figure.
#
StartServers 4

#
# Limit on total number of servers running, i.e., limit on the number
# of clients who can simultaneously connect --- if this limit is ever
# reached, clients will be LOCKED OUT, so it should NOT BE SET TOO LOW.
# It is intended mainly as a brake to keep a runaway server from taking
# the system with it as it spirals down...
#
MaxClients 150

#
# MaxRequestsPerChild: the number of requests each child process is
# allowed to process before the child dies. The child will exit so
# as to avoid problems after prolonged use when Apache (and maybe the
# libraries it uses) leak memory or other resources. On most systems, this
# isn't really needed, but a few (such as Solaris) do have notable leaks
# in the libraries. For these platforms, set to something like 10000
# or so; a setting of 0 means unlimited.
#
# NOTE: This value does not include keepalive requests after the initial
# request per connection. For example, if a child process handles
# an initial request and 10 subsequent "keptalive" requests, it
# would only count as 1 request towards this limit.
#
MaxRequestsPerChild 500

Include conf/addon-modules/php.conf
Include conf/mailman.conf
Include conf/ssl/mod_ssl.conf
Include conf/ssl/ssl.default-vhost.conf




sorry about attacing this huge file,
but perhaps if you actually saw whats in it, it would help.

goon12
02-10-2003, 12:28 PM
lastly, the comment about copying the php.ini-dist file, where exactly would that file be located?

That should be in the directory that you compiled the source from, sorry I was assuming you installed from source.

sivel
02-10-2003, 12:34 PM
actually,
the whole apache and php thing was installed during installation of mandrake.

sivel
02-10-2003, 03:24 PM
anybody? help plz

KilerCris
02-10-2003, 04:15 PM
put in these commands to find the file.


updatedb
locate php.ini-dist

KilerCris
02-10-2003, 04:16 PM
Where it says this:


<IfDefine HAVE_PHP4>
AddModule mod_php4.c
</IfDefine>


Try commenting out or removing the first and last lines.

sivel
02-10-2003, 04:24 PM
just out of curiosity,

why should i comment it out? it was put there by linux.i didnt add that line, but i sure as hell am gonna try it. its really burning my a@#.

thnaks,
sivel

sivel
02-10-2003, 04:39 PM
well, i did the command to locate the php.ini-dist file, and nothing happened.--just jumped to the next line. i also # out the lines you mentioned as well as removed them, and sill, just code on the php page.incedentaly, is the command to restert the http server ./httpd? (when in the right directory of course)

thanks,
sivel

vze4gmkk
02-10-2003, 04:55 PM
To stop:
if the program is in your $PATH:
httpd stop
- or -
apachectl stop
If not:
./httpd stop
- or -
./apachectl stop
httpd and apachectl do the same things
To start:
Same as above but
httpd start
apachectl start

sivel
02-10-2003, 05:00 PM
thanks. for the command.

KilerCris
02-10-2003, 08:36 PM
httpd -k restart

will do it all at once. No setting changes in php or Apache will take effect until you restart Apache, BTW.

sivel
02-10-2003, 08:38 PM
ive tried everythimg i can reasonably think of. does anyone
have a php.in and httpd.conf from a mandrake 9.0 box they can paste?

thanks,
sivel

KilerCris
02-10-2003, 08:38 PM
You'd comment it out because maybe HAVE_PHP isn't getting set. Something worth trying.

Try

locate php.ini


or just check if /etc/php.ini exists

sivel
02-10-2003, 08:43 PM
when i did the command to restart like you had specified,
it gave me the old invalid option shpiel and gave me all of the options of which -k was not one of them, so i just did the httpd restart command. what exactly did the -k option specifically do?

thanks,
sivel:D