标签: apache2

在PHP中包含不同类型的文件

我接手了一个PHP项目,我试图让它在我的开发盒上运行.我是开发人员而不是系统管理员,所以我无法让它工作.

以前的开发人员使用.h文件来包含PHP.我当前的配置是使用该.h文件并包含它而不执行它.在我的apache配置中需要查找什么(或者是我的php.ini)?

编辑:

当我阅读下面的评论之一时点击了一些东西.代码使用ASP样式标签" <?".我已经在php.ini中打开了选项,并且根据phpinfo(),它已启用,但是apache仍然只是将代码包含为文本.

我只是检查了它并运行代码与完整的开放PHP标签" <?php"修复了问题.话虽如此,我仍然希望它以另一种方式工作.

我正在使用最新版本的Macbook上运行代码.PHP 5.2.6,postgresql 8.3和apache 2.

该代码适用于登台服务器,但我无法弄清楚它有什么区别.

编辑

Durrr ...我没有在php.ini中启用short_open_tags.

php apache2 include

3
推荐指数
1
解决办法
706
查看次数

在Rails中,我应该启用serve_static_assets吗?

我目前正在使用Apache代理瘦(使用这篇文章)

我的静态资产都不起作用(例如样式表,javascripts).就是Apache应该是为他们服务或做我必须启用config.serve_static_assets的config/environments/production.rb?如果Apache应该为他们服务,那么我可能做错了什么?

这是我的Apache配置:

<VirtualHost *:80>
  ServerName example.com
  ServerAlias www.example.com

  DocumentRoot /home/r/public_html/example/public

  RewriteEngine On

  <Proxy balancer://thinservers>
    BalancerMember http://127.0.0.1:5000
    BalancerMember http://127.0.0.1:5001
    BalancerMember http://127.0.0.1:5002
  </Proxy>

  # Redirect all non-static requests to thin
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
  RewriteRule ^/(.*)$ balancer://thinservers%{REQUEST_URI} [P,QSA,L]

  ProxyPass / balancer://thinservers/
  ProxyPassReverse / balancer://thinservers/
  ProxyPreserveHost on

  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>

  # Custom log file locations
  ErrorLog  /home/r/public_html/example/log/error.log
  CustomLog /home/r/public_html/example/log/access.log combined

</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails apache2 thin ruby-on-rails-3

3
推荐指数
1
解决办法
2174
查看次数

如何在不杀死运行php的情况下使站点脱机进行维护从http端开始?

我写了一个剧本 upload_songs.php

从命令行执行时

$ php upload_songs.php
Run Code Online (Sandbox Code Playgroud)

我可以让网站离线

$ a2dissite my_website
$ service apache2 reload
Run Code Online (Sandbox Code Playgroud)

并且upload_songs.php将继续运行

然而,当我执行upload_songs.php通过将来自HTTP侧my_website.com/upload_songs.php,如果我做了以下

$ a2dissite my_website
$ service apache2 reload
Run Code Online (Sandbox Code Playgroud)

php进程upload_songs.php被杀死了.如何在不杀死从http端启动的运行php进程的情况下使站点脱机进行维护?

php linux apache apache2

3
推荐指数
1
解决办法
185
查看次数

表现不佳

我正在为我的硕士论文进行性能测试,而且我的Symfony2简单应用程序的性能非常差.它是简单的应用程序,一个查询和一些数学.

命令测试结果:

ab -c10 -t60 http://sf2.cities.localhost/app.php

Server Software:        Apache/2.2.20
Server Hostname:        sf2.cities.localhost
Server Port:            80

Document Path:          /app.php
Document Length:        2035 bytes

Concurrency Level:      10
Time taken for tests:   60.162 seconds
Complete requests:      217
Failed requests:        68
   (Connect: 0, Receive: 0, Length: 68, Exceptions: 0)
Write errors:           0
Non-2xx responses:      68
Total transferred:      393876 bytes
HTML transferred:       321102 bytes
Requests per second:    3.61 [#/sec] (mean)
Time per request:       2772.458 [ms] (mean)
Time per request:       277.246 [ms] (mean, across all concurrent …
Run Code Online (Sandbox Code Playgroud)

php benchmarking apache2 apachebench symfony

3
推荐指数
1
解决办法
802
查看次数

如何在apache中为mac os x上的play framework web app设置反向代理

我正在尝试将带有反向代理的apache前端添加到端口9000上的播放框架应用程序.我已根据播放文档尝试了以下httpd配置:http://www.playframework.org/documentation/2.0. 2/HttpServer的

<VirtualHost *:80>
  ProxyPreserveHost On
  ServerName http://localhost
  ProxyPass / http://127.0.0.1:9000/
  ProxyPassReverse / http://127.0.0.1:9000/
  LogLevel debug
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

我只加载了mod_proxy模块,但已注释掉所有其他代理相关模块(http,ajp,jk等).

当我尝试点击时http://localhost,我在错误日志中得到以下内容:

[debug] mod_proxy_ajp.c(45): proxy: AJP: canonicalising URL //localhost:8009/
[debug] proxy_util.c(1506): [client ::1] proxy: ajp: found worker ajp://localhost:8009/ for ajp://localhost:8009/
[debug] mod_proxy.c(1015): Running scheme ajp handler (attempt 0)
[debug] mod_proxy_http.c(1963): proxy: HTTP: declining URL ajp://localhost:8009/
[debug] mod_proxy_ajp.c(672): proxy: AJP: serving URL ajp://localhost:8009/
[debug] proxy_util.c(1949): proxy: AJP: retrying the worker for (localhost)
[error] proxy: AJP: disabled connection for (localhost) …
Run Code Online (Sandbox Code Playgroud)

macos reverse-proxy apache2 playframework playframework-2.0

3
推荐指数
1
解决办法
8528
查看次数

如果不存在,mod_rewrite规则附加index.html

什么是mod_rewrite规则附加index.html到以正斜杠结尾的任何URL?规则应保留存在的任何查询字符串.我无法使用该DirectoryIndex指令,因为index.html文件在文件系统上实际上并不存在,但是底层网站框架需要这些文件.

一些示例URL和所需结果如下所示:

http://example.com/                   -> http://example.com/index.html
http://example.com/?a=1               -> http://example.com/index.html?a=1
http://example.com/foo/               -> http://example.com/foo/index.html
http://example.com/foo/?b=2           -> http://example.com/foo/index.html?b=2
http://example.com/foo/index.html     -> http://example.com/foo/index.html
http://example.com/foo/index.html?c=3 -> http://example.com/foo/index.html?c=3
Run Code Online (Sandbox Code Playgroud)

apache mod-rewrite apache2

3
推荐指数
1
解决办法
2318
查看次数

从安全https重定向到仅一页的http

我有一个页面,如果访问它page.php我需要被重定向到http,https否则我的谷歌广告将不会显示.

确切地说,我希望发生以下情况:

https://site.com/page.php?blah=foo?bar=blah - > http://site.com/page.php?blah=foo?bar=blah

我到目前为止尝试过:

RewriteCond %{HTTP_HOST} on

RewriteRule ^page\.php$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

但这不起作用.有什么建议?

php https redirect http apache2

3
推荐指数
1
解决办法
1万
查看次数

由于apache2配置,Laravel 4控制器路由无法正常工作

我正试图在家里的本地服务器上设置laravel,我似乎无法获得控制器路由,例如:

Route::controller('home','home');
Run Code Online (Sandbox Code Playgroud)

这段代码可以在我工作的服务器上运行,并且我已经阅读了几个论坛,这个论坛声称问题是因为apache2没有配置为查看.htaccess文件.

我已经搞砸了一段时间,但我似乎仍无法得到任何工作.我进入/ etc/apache2/sites-available并创建了我自己的配置文件,名为site1,如下所示:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/laravel/
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /var/www/laravel/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None …
Run Code Online (Sandbox Code Playgroud)

php apache apache2 laravel laravel-4

3
推荐指数
1
解决办法
6557
查看次数

Zend Server Windows - 授权标头未传递给PHP脚本

我有一个PHP应用程序,需要独立于包含Apache服务器执行HTTP基本身份验证.

在Linux机器上,通过安装php apt-get php,我发现Authorization标题没有出现$_SERVER,但可以通过apache_request_headers()或getallheaders().

在使用Zend Server 6.1.0/PHP 5.4的Windows开发机器上,我无法Authorization通过上述任何方法从PHP内部获取标头值.我怎样才能获得它的价值?

mod_fcgid?

我无法确定它,但似乎Zend Server可能使用FCGI将Apache请求分派给PHP(例如,变量PHP_FCGI_MAX_REQUESTS出现在其中$_SERVER).

如果这是真的,它会解释我的问题,因为mod_fcgid故意Authorization从应用程序中删除标题,请参阅http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html#fcgidpassheader

我尝试添加

FcgidPassHeader Authorization
Run Code Online (Sandbox Code Playgroud)

对我的阿帕奇httpd.conf,但它只是抱怨:

Invalid command 'FcgidPassHeader', perhaps misspelled or defined by a module not included in the server configuration
Run Code Online (Sandbox Code Playgroud)

的mod_fastcgi?

同样,也许Zend正在使用mod_fastcgi?基于此页面http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html#FastCgiConfig我尝试将以下内容添加到我的apache httpd.conf:

FastCgiConfig -pass-header Authorization
Run Code Online (Sandbox Code Playgroud)

再次,它只是抱怨说:

Invalid command 'FastCgiConfig', perhaps misspelled or defined by a module not included in the …
Run Code Online (Sandbox Code Playgroud)

php windows zend-framework apache2

3
推荐指数
1
解决办法
4450
查看次数

新的Laravel安装v 5.4 index.php引发解析错误。PHP 7.2.10-0ubuntu0.18.04.1

在Ubuntu的Digital Ocean上安装了新的Laravel。当前的PhP安装。我添加了几行代码以吐出错误,Apache2可以很好地访问Php。这是输出:

解析错误:语法错误,第388行上的/var/www/html/blog/vendor/laravel/framework/src/Illuminate/Support/Arr.php中出现意外的'='

    public static function pluck($array, $value, $key = null)
{
    $results = [];
    [$value, $key] = static::explodePluckParameters($value, $key);
    foreach ($array as $item) {
        $itemValue = data_get($item, $value);
        // If the key is "null", we will just append the value to the array and keep
        // looping. Otherwise we will key the array using the value of the key we
        // received from the developer. Then we'll return the final array form.
        if (is_null($key)) {
            $results[] = $itemValue;
        } …
Run Code Online (Sandbox Code Playgroud)

php apache2 laravel

3
推荐指数
1
解决办法
3868
查看次数