首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ubuntu server 12.04 - php文件下载

ubuntu server 12.04 - php文件下载
EN

Stack Overflow用户
提问于 2012-12-12 19:07:56
回答 1查看 1K关注 0票数 1

希望有人能帮助我,我有同样的问题与php文件试图下载。

我已经尝试了所有答案,除了:

在-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

当我尝试它们的时候,我得到无法创建符号链接文件存在,所以我想这些都已经准备好了,其他人还有什么我可以尝试的,我是linux的新手,我按照这个指南来设置所有的东西:http://www.howtoforge.com/perfect-server-ubuntu-12.04-lts-apache2-bind-dovecot-ispconfig-3

奇怪的是joomla和drupal站点可以工作,而自己的php脚本却不行。

我已经尝试了这个页面上的所有东西:apache2 on ubuntu - php files downloading,但它们都不起作用。

当我尝试运行这个命令: sudo a2enmod php我得到,模块php不存在。我想我需要运行一个命令来安装它?如果是的话请告诉我是什么。

谢谢大家。

以下是根据要求提供的更多信息:

不确定isp config存储每个网站的文件夹的位置,但我连接到ftp站点并上传到web文件夹,这与我对正在运行的drupal和joomla站点所做的操作相同

已启用站点:

代码语言:javascript
复制
/
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@

所有的站点都在运行(它们运行的是joomla或drupal),但是www.jubileeleather.co.uk/index.php不得不上传一个html文件,直到我对其进行排序。

php脚本:

代码语言:javascript
复制
    <?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');
    }
    ?>

我正在通过ssh使用putty,我如何从文件中复制内容发布到这里?另外,您还需要哪些文件?再次感谢。

以下是jubileeleather v主机文件的内容,不确定我在这里寻找的是什么:

代码语言:javascript
复制
 AllowOverride None     Order Deny,Allow     Deny from all 
代码语言:javascript
复制
   DocumentRoot /var/www/jubileeleather.co.uk/web
代码语言:javascript
复制
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>

EN

回答 1

Stack Overflow用户

发布于 2012-12-12 19:44:17

除了有自己的PHP文件在一个目录中启用PHP解析(不能真正说它是如何与Apache做的,因为我没有使用一段时间),你应该检查你的脚本是否有正确的扩展名(应该总是.php)和脚本开始标签<?php -不要使用短标签<?,以避免移动脚本到实时服务器时可能出现的问题。

但是,由于您的文件是返回下载的,我认为您的脚本没有放在启用了PHP解析的目录中。发布您的Apache和PHP配置文件可以帮助我们识别问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13838386

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档