Results 1 to 4 of 4
I have read online several threads addressing apache not being able to read php files, however everything I have tried has failed to work. I am running 12.1 Suse. I ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-22-2012 #1
- Join Date
- Sep 2012
Can't get apache to read php files help?
I have tried chmod 777 everything and giving wwwrun ownership of files. That got rid of error messages I was recieving in the log, but still php files were not being read.
I tried creating an htaccess file and adding into it
AddType application/x-httpd-php .php .phtml
and setting the default page to be read as index.php as well as index.html.
I tried adding this into my httpd.conf file and all I got was a syntax error message and apache refusing to start. So I removed it and apache worked again.
I noticed a file called mime.types that already has application/x-httpd-php .php .phtml
specified in there.
I also was able to setup the MySQL server and I am able to get into phpMyAdmin.
*update* Today I found out by creating only php files with no html code in them that apache will download the php file instead of interpeting the code. I made a sample info.php file and apache will download it rather than send it to php to interpet. I downloaded a php file showing all the php code in info.php
I read that this means my problem is that apache is failing to pass the file to the PHP handler. How do I fix this? Where is the PHP handler?
my httpd.config file
### Global Environment ################################################## ####
# The directives in this section affect the overall operation of Apache,
# such as the number of concurrent requests.
# run under this user/group id
# - how many server processes to start (server pool regulation)
# - usage of KeepAlive
# ErrorLog: The location of the error log file.
# If you do not specify an ErrorLog directive within a <VirtualHost>
# container, error messages relating to that virtual host will be
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
# generated from APACHE_MODULES in /etc/sysconfig/apache2
# IP addresses / ports to listen on
# predefined logging formats
# generated from global settings in /etc/sysconfig/apache2
# optional mod_status, mod_info
# optional cookie-based user tracking
# read the documentation before using it!!
# configuration of server-generated directory listings
# associate MIME types with filename extensions
# set up (customizable) error responses
# global (server-wide) SSL configuration, that is not specific to
# any virtual host
# forbid access to the entire filesystem by default
allow from all
# use .htaccess files for overriding,
# and never show them
<Files ~ "^\.ht">
allow from all
# List of resources to look for when the client requests a directory
DirectoryIndex index.php index.html index.html.var
### 'Main' server configuration #############################################
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
# Another way to include your own files
# The file below is generated from /etc/sysconfig/apache2,
# include arbitrary files as named in APACHE_CONF_INCLUDE_FILES and
### Virtual server configuration ############################################
# VirtualHost: If you want to maintain multiple domains/hostnames on your
# machine you can setup VirtualHost containers for them. Most configurations
# use only name-based virtual hosts so the server doesn't need to worry about
# IP addresses. This is indicated by the asterisks in the directives below.
# Please see the documentation at
# for further details before you try to setup virtual hosts.
# You may use the command line option '-S' to verify your virtual host
# Note: instead of adding your own configuration here, consider
# adding it in your own file (/etc/apache2/httpd.conf.local)
# putting its name into APACHE_CONF_INCLUDE_FILES in
# /etc/sysconfig/apache2 -- this will make system updates
# This file controls what Internet media types are sent to the client for
# given file extension(s). Sending the correct media type to the client
# is important so they know how to handle the content of the file.
# For more information about Internet media types, please read
# RFC 2045, 2046, 2047, 2048, and 2077. The Internet media type
# registry is at .
# MIME type Extension
application/pgp-encrypted pgp gpg
application/pgp-keys skr pkr
application/smil smil smi sml
application/vnd.lotus-1-2-3 123 wk1 wk3 wk4 wks
application/vnd.ms-excel xls xlc xll xlm xlw xla xlt xld
application/vnd.ms-powerpoint ppz ppt pps pot
application/vnd.stardivision.impress sdd sdp
application/vnd.stardivision.writer sdw vor sgl
application/x-abiword abw abw.CRASHED abw.gz zabw
application/x-blender blender blend BLEND
application/x-bzip bz bz2
application/x-bzip bz2 bz
application/x-bzip-compressed-tar tar.bz tar.bz2
application/x-bzip-compressed-tar tar.bz tar.bz2 tbz tbz2
application/x-compressed-tar tar.gz tar.Z tgz taz
application/x-compressed-tar tar.gz tgz
application/x-desktop desktop kdelnk
application/x-font-ttf ttc TTC
application/x-font-type1 pfa pfb gsf pcf.Z
application/x-genesis-rom gen md
application/x-gnucash gnucash gnc xac
application/x-httpd-php .php .phtml .php3
application/x-java-archive jar ear war
application/x-jbuilder-project jpr jpx
application/x-kpresenter kpr kpt
application/x-kword kwd kwt
application/x-lha lha lzh
application/x-lzop-compressed-tar tar.lzo tzo
application/x-netcdf cdf nc
application/x-palm-database pdb prc
application/x-par2 PAR2 par2
application/x-perl pl pm al perl
application/x-php php php3 php4
application/x-pkcs12 p12 pfx
application/x-planner planner mrproject
application/x-python-bytecode pyc pyo
application/x-quattro-pro wb1 wb2 wb3
application/x-quattropro wb1 wb2 wb3
application/x-scribus sla sla.gz scd scd.gz
application/x-smil smi smil
application/x-sms-rom sms gg
application/x-stuffit bin sit
application/x-trash bak old sik
application/x-troff tr roff t
application/x-tzo tar.lzo tzo
application/x-x509-ca-cert der cer crt cert pem
audio/basic au snd
audio/midi mid midi
audio/prs.sid sid psid
audio/x-aiff aif aiff
audio/x-aiff aiff aif aifc
audio/x-mod mod ult uni XM m15 mtm 669
audio/x-pn-realaudio ra ram rm
audio/x-pn-realaudio ram rmm
audio/x-scpls pls xpl
image/jpeg jpeg jpg jpe
image/tiff tif tiff
image/vnd.djvu djvu djv
image/x-compressed-xcf xcf.gz xcf.bz2
image/x-dcraw bay BAY bmq BMQ cr2 CR2 crw CRW cs1 CS1 dc2 DC2 dcr DCR fff FFF k25 K25 kdc KDC mos MOS mrw MRW nef NEF orf ORF pef PEF raf RAF rdc RDC srf SRF x3f X3F
image/x-eps eps epsi epsf
image/x-lwo lwo lwob
image/x-pict pict pict1 pict2
text/calendar vcs ics
text/css css CSSL
text/directory vcf vct gcrd
text/html html htm
text/plain txt asc
text/sgml sgml sgm
text/spreadsheet sylk slk
text/x-adasrc adb ads
text/x-c++src cpp cxx cc C c++
text/x-chdr h h++ hp
text/x-pascal p pas
text/x-patch diff patch
text/x-tcl tcl tk
text/x-tex tex ltx sty cls
text/x-texinfo texi texinfo
text/x-texmacs tm ts
text/x-uri uri url
text/x-xslfo fo xslfo
text/x-xslt xslt xsl
video/dv dv dif
video/mpeg mpeg mpg mp2 mpe vob dat
video/quicktime qt mov moov qtvr
video/x-flic fli flc
video/x-ms-asf asf asx
video/x-nsv nsv NSV
AddHandler application/x-httpd-php .html
AddHandler application/x-httpd-php .htm
Last edited by Gizmo007; 09-22-2012 at 02:45 PM.
- 09-22-2012 #2
When you try to access a .php file on your server, what messages appear in your log? You should look in both the access log file and the error log file. I'm not sure where SuSE keeps it's apache logs, but I'd look for them in /var/log/httpd.
It should be obvious what is going wrong from reading those messages - but if it's not, then post them up here and we'll try to help.Linux user #126863 - see http://linuxcounter.net/
- 09-22-2012 #3
- Join Date
- Sep 2012
Ok I don't know how I did it, but now I can get info.php and helloworld.php to work in the browser. Index.php however still will not work, if I rename it to somefile.php then it will work fine.
in my DirectyIndex I have index.php index.html listed, but still apache will not recognize index.php for some reason even though it is listed in my config files.
Also phpMyAdmin now does not work after I got my php files to work in the browser. It was working before, but now apache won't even display it in the browser. My sql server is up and running fine, I could log into sql server fine from a shell prompt.
I am not getting any error messages in my logs today. Last night I was getting error messages that the ip address of the computer I was on was being denied permission to access index.php, I was still able to access index.html. I changed permissions and gave ownership of my www directory to wwwrun and that error went away. However still today index.php will not show up in my browser. Why?
__________________________________________________ __________________________________________________ ______________________
*updated* oh I can't believe this! I finally did get the index.php to work. For some reason when I create my php files on a windows machine and then ftp them to my linux server the server is adding spaces between the file name and the .php. So the reason some php files were not being read is because there was space added between the name and the .php. Why this happend I have no idea. looking closely I saw my index file was named "index .php" instead of "index.php". I don't know why linux decided to add a space between the "index" and the ".php" when I ftp'ed the file from my windows machine. So I just renamed the file from "index .php" to "index.php" and it worked fine. That simple space created so much of a nightmare!
I still am not able to get my phpMyAdmin to work. I had it working before when none of my php files were showing up in the browser, now I can't get it work. I can get into SQL Server from a shell prompt.
Last edited by Gizmo007; 09-22-2012 at 05:14 PM.
- 09-23-2012 #4
- Join Date
- Sep 2012
I fixed it !
I just decided to reinstall mysql server on linux and now phpMyAdmin is working fine. So I have a fully functional LAMP sever now
now next project, get Tomcat working ...