1

hoping someone can help me, i am having the same problem with the php files trying to download.

i have tried all answers but the:

ln -s /etc/apache2/mods-available/php5.conf /etc/apache2/mods-enabled/php5.conf ln -s /etc/apache2/mods-available/php5.load /etc/apache2/mods-enabled/php5.load

when i try them i get unable to create symbolic link file exists, so i guess thats done all ready, anyone else have anything more i can try, i am new to linux and i followed this guide to set everything up: http://www.howtoforge.com/perfect-server-ubuntu-12.04-lts-apache2-bind-dovecot-ispconfig-3

the strange thing is joomla and drupal sites work, but own php script doesent.

i have tried everything on this page: apache2 on ubuntu - php files downloading but none of them work.

when i try to run this command: sudo a2enmod php i get, module php does not exist. i guess i need to run a command to install it? if so what is it please.

thanks all.

Heres More info as requested:

not sure where isp config stores the folders for each website, but i connected to the ftp site and uploaded into the web folder, same as i did for the working drupal and joomla sites that are working

sites enabled:

/
000-apps.vhost@
000-default@
000-ispconfig.conf@
000-ispconfig.vhost@
100-analytics.cyberglide.co.uk.vhost@
100-cyberglide.co.uk.vhost@
100-hideandcollars.co.uk.vhost@
100-jubileeleather.co.uk.vhost@
100-rookselectrical.co.uk.vhost@
100-wolds-uniforms.co.uk.vhost@

all sites are working (they are running joomla or drupal) but www.jubileeleather.co.uk/index.php had to put up a html file until i can get it sorted.

php script:

    <?php
    //Add required class and config files below
    require ('_class/cms.php');
    require ('config/db.php');

    //Get Required Page, if its not set call it the index
   $page = (isset($_GET['page'])) ? $_GET['page'] : 'index';

   //If the page is set as index
    if($page == 'index'){
    //Include Index
    require ('public/index.php');
    }

    //Else if the page is contact
    elseif ($page == 'contact') {
    //Include Contact
    require ('public/contact.php');

    //If the page is none of the above  
    } else {
    //Include Layout
    require ('public/layout.php');
    }
    ?>

i am using putty via ssh, how would i copy content from a file to post on here? also which files would you need? thanks again.

here is the contents of the jubileeleather v host file, not sure what i am looking for in here:

AllowOverride None Order Deny,Allow Deny from all

DocumentRoot /var/www/jubileeleather.co.uk/web

ServerName jubileeleather.co.uk
ServerAlias www.jubileeleather.co.uk
ServerAdmin webmaster@jubileeleather.co.uk

ErrorLog /var/log/ispconfig/httpd/jubileeleather.co.uk/error.log

Alias /error/ "/var/www/jubileeleather.co.uk/web/error/"
ErrorDocument 400 /error/400.html
ErrorDocument 401 /error/401.html
ErrorDocument 403 /error/403.html
ErrorDocument 404 /error/404.html
ErrorDocument 405 /error/405.html
ErrorDocument 500 /error/500.html
ErrorDocument 502 /error/502.html
ErrorDocument 503 /error/503.html

<IfModule mod_ssl.c>
</IfModule>

<Directory /var/www/jubileeleather.co.uk/web>
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
<Directory /var/www/clients/client3/web4/web>
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>



# suexec enabled
<IfModule mod_suexec.c>
  SuexecUserGroup web4 client3
</IfModule>
# Clear PHP settings of this website
<FilesMatch "\.ph(p3?|tml)$">
    SetHandler None
</FilesMatch>
# php as fast-cgi enabled
# For config options see: http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
<IfModule mod_fcgid.c>
    IdleTimeout 300
    ProcessLifeTime 3600
    # MaxProcessCount 1000
    DefaultMinClassProcessCount 0
    DefaultMaxClassProcessCount 100
    IPCConnectTimeout 3
    IPCCommTimeout 360
    BusyTimeout 300
</IfModule>
<Directory /var/www/jubileeleather.co.uk/web>
    AddHandler fcgid-script .php .php3 .php4 .php5
    FCGIWrapper /var/www/php-fcgi-scripts/web4/.php-fcgi-starter .php
    Options +ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
<Directory /var/www/clients/client3/web4/web>
    AddHandler fcgid-script .php .php3 .php4 .php5
    FCGIWrapper /var/www/php-fcgi-scripts/web4/.php-fcgi-starter .php
    Options +ExecCGI
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>


# add support for apache mpm_itk
<IfModule mpm_itk_module>
  AssignUserId web4 client3
</IfModule>

<IfModule mod_dav_fs.c>
  # Do not execute PHP files in webdav directory
  <Directory /var/www/clients/client3/web4/webdav>
    <FilesMatch "\.ph(p3?|tml)$">
      SetHandler None
    </FilesMatch>
  </Directory>
  DavLockDB /var/www/clients/client3/web4/tmp/DavLock
  # DO NOT REMOVE THE COMMENTS!
  # IF YOU REMOVE THEM, WEBDAV WILL NOT WORK ANYMORE!
  # WEBDAV BEGIN
  # WEBDAV END
</IfModule>

Community
  • 1
  • 1
Michael Rooks
  • 39
  • 1
  • 2
  • 8
  • where did you place your php script? What are the contents of /etc/apache2/sites-enabled? You should see a file called 000-default there. Was is the content of the file? – steven Dec 12 '12 at 11:28
  • do you have a root server? It looks like php is not enabled for your domain or the .php extension is not associated to be parsed with php. If joomla and drupal works, so php is running on your server. take a look into 100-jubileeleather.co.uk.vhost@ to see what is configured there. – steven Dec 12 '12 at 12:21
  • thanks for your help, updated with the vhost file too – Michael Rooks Dec 12 '12 at 13:47
  • fousd the issue, compared all the .htaccess files and noticed there was this in there from the old server: AddType x-mapp-php5 .php AddHandler x-mapp-php5 .php removed now fine. thanks for all your help – Michael Rooks Dec 12 '12 at 14:52

1 Answers1

0

Apart from having the own PHP files in a directory with PHP parsing enabled (can't really say how it's done with Apache as I'm not using for some time), you should check if your script has the correct extension (should be always .php) and script opening tag <?php - don't use short tag <? to avoid possible problems when moving the script to live server.

Tho since your files are returned for download, I think you don't have your scripts in directory with enabled PHP parsing. Posting your Apache and PHP config files could help us to identify the problem.

danaketh
  • 148
  • 1
  • 6