Source shown instead of page

From phpCMS

Jump to: navigation, search

[edit] Instead of a page, its source-code is shown

If a page like http://domain.tld/index.htm is not shown properly in phpCMS using Apache, but instead only the sourcecode is shown, even though

  • the project file is properly given in the content file,
  • the pathes are correct,
  • the extension of your file is the same as set in /parser/include/default.php ($this->PAGE_EXTENSION - standard value '.htm')
  • the parser properly shows the administration user interface when being accessed directly (.../parser/parser.php as default),

this can have a couple of reasons.

Now, to determine if it's the basic setup, try the following: Try accessing a page that doesn't exist (on the same domain, of course), e.g. http://domain.tld/index_doesntexist.htm. If the following error page is created by Apache, we now know that the *.htm content files are never handed to phpCMS and thus cannot be parsed.

Now, try calling your index page without using stealth mode, e.g. http://domain.tld/parser/parser.php?file=index.htm. If the page is still shown as source code, your phpCMS installation is broken - otherwise, phpCMS works as intended, and we know that it's the stealth mode we have to debug. Stealth-mode is configured/activated using '.htaccess' files - so we need to verify that those are okay.

This is especially important if the content-file in question is not located in the document root, but somewhere deeper in the directory structure, as Apache uses a bottom-up search to find the proper .htaccess file, and stops when it finds the first one. Thus, it is impossible to simply have one .htaccess file in the document root which enables the phpCMS stealth mode, and put another one with different settings in a subdirectory - the latter one will cancel out the firstmentioned one.

Now, if we got this far and made sure that the *.htm files are indeed interpreted properly by phpCMS, but are not send there by Apache, we got a couple of possible problems we have to check:

  • Apache is set up not to read the .htaccess file or expect it with a different name - see your Apache config or ask your admin about it. To see if an .htaccess file is used at all, simply write some random characters in yours, access a page that's in the same directory and see if Apache complains about an error in your .htaccess. If it doesn't, the file doesn't get read in.
  • The content of your .htaccess is wrong. Compare your file with the "example.htaccess" that's included in the phpCMS package (don't forget to adjust the paths)
  • Make sure that there is no 'additional' .htaccess in the subdirectory - if there is, you need to add similar phpCMS activation code like in the main .htaccess, just with the path corrected.
  • Make sure that the "AllowOverride" directive in Apache is not set to "None" for your directory, or all the settings you're doing in your .htaccess will be ignored.

Bassed on a (German) thread in our phpCMS supportforum

Main Page: Tutorials MainPage | Top Page: MiniHowTos MainPage

Diese Seite in anderen Sprachen: Deutsch

Personal tools