doujie3888 2012-12-12 11:07
浏览 36

ubuntu服务器12.04 - php文件下载

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>

  • 写回答

1条回答 默认 最新

  • douyiyang6317 2012-12-12 11:44
    关注

    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.

    评论

报告相同问题?

悬赏问题

  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?