简体   繁体   English

ubuntu服务器12.04-PHP文件下载

[英]ubuntu server 12.04 - php files downloading

hoping someone can help me, i am having the same problem with the php files trying to download. 希望有人可以帮助我,我在尝试下载php文件时遇到了同样的问题。

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 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 当我尝试使用它们时,我无法创建符号链接文件,因此,我猜这已经做好了准备,其他任何人都可以尝试,我是linux的新手,我按照本指南进行了设置: 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. 奇怪的是,joomla和drupal网站都可以工作,但是自己的php脚本却没有。

i have tried everything on this page: apache2 on ubuntu - php files downloading but none of them work. 我已经尝试过此页面上的所有内容: ubuntu上的apache2-下载php文件,但没有一个起作用。

when i try to run this command: sudo a2enmod php i get, module php does not exist. 当我尝试运行此命令时:我得到sudo a2enmod php,php模块不存在。 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 不确定isp config在哪里存储每个网站的文件夹,但是我连接到ftp站点并上传到了web文件夹,就像我为正在工作的drupal和joomla网站所做的一样

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. 所有站点都在工作(它们正在运行joomla或drupal),但是www.jubileeleather.co.uk/index.php必须放置一个html文件,直到我将其排序为止。

php script: php脚本:

    <?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? 我正在通过ssh使用腻子,我将如何从文件中复制内容以在此处发布? 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: 这是jubileeleather v主机文件的内容,不确定我在这里寻找什么:

AllowOverride None Order Deny,Allow Deny from all AllowOverride无命令拒绝,允许全部拒绝

DocumentRoot /var/www/jubileeleather.co.uk/web 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>

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 <? 除了在目录中启用PHP解析的目录中拥有自己的PHP文件(由于我一段时间未使用过,不能真正说出Apache是​​如何完成的)之外,还应该检查脚本是否具有正确的扩展名(应始终.php)和脚本开始标记<?php不要使用短标记<? 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. 由于您的文件已退回下载,因此我认为在启用了PHP分析的目录中没有脚本。 Posting your Apache and PHP config files could help us to identify the problem. 发布您的Apache和PHP配置文件可以帮助我们确定问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM