apache支持php,Apache支持PHP

本文目录一览:

apache2.2支持php哪些版本

PHP 5.2.x 以上均可。 目前最好的最新版本是 PHP 5.2.10 webserver 搭配不像组装机硬件搭配,才有最合适的组合,apache2 与PHP5本身就是最好的搭档组合。 但用于运营的webserver,最好还是不要盲目升级版本,还是要挑选最合适自身运营的版本使用

如何让已经安装的apache支持php

linux下apache+PHP+Mysql简易配置 OS:RedHat AS4 (1). apache安装 下载 wget -2.0.55.tar.gz 解压 tar zxvf httpd-2.0.55.tar.gz 配置 cd httpd-2.0.55 ./configure –prefix=/usr/local/apache-2.0.55 \ –with-mpm=prefork \ –enable-vhost-alias \ –enable-rewrite \ –enable-expires \ –enable-so 编译并安装 make

差不多就是这个样子了,还有什么问题可以在后盾人查找,在这里就不多说了

PHP运行于Apache 模块方式

当使用 PHP 作为 Apache 模块时,也可以用 Apache 的配置文件(例如 httpd.conf)和 .htaccess 文件中的指令来修改 PHP 的配置设定。需要有“AllowOverride Options”或“AllowOverride All”权限才可以。

有几个 Apache 指令可以使用户在 Apache 配置文件内部修改 PHP 的配置。哪些指令属于 PHP_INI_ALL,PHP_INI_PERDIR 或 PHP_INI_SYSTEM 中的哪一个,请参考附录中的 php.ini 配置选项列表。

php_value name value

设定指定的值。只能用于 PHP_INI_ALL 或 PHP_INI_PERDIR 类型的指令。要清除先前设定的值,把 value 设为 none。

Note: 不要用 php_value 设定布尔值。应该用 php_flag(见下面)。

php_flag name on|off

用来设定布尔值的配置指令。仅能用于 PHP_INI_ALL 和 PHP_INI_PERDIR 类型的指令。

php_admin_value name value

设定指定的指令的值。不能用于 .htaccess 文件。任何用 php_admin_value 设定的指令都不能被 .htaccess 或 virtualhost 中的指令覆盖。要清除先前设定的值,把 value 设为 none。

php_admin_flag name on|off

用来设定布尔值的配置指令。不能用于 .htaccess 文件。任何用 php_admin_flag 设定的指令都不能被 .htaccess 或 virtualhost 中的指令覆盖。

Example #1 Apache 配置例子

IfModule mod_php5.c

php_value include_path “.:/usr/local/lib/php”

php_admin_flag engine on

/IfModule

IfModule mod_php4.c

php_value include_path “.:/usr/local/lib/php”

php_admin_flag engine on

/IfModule

Caution

PHP 常量不存在于 PHP 之外。例如在 httpd.conf 中不能使用 PHP 常量如 E_ALL 或 E_NOTICE 来设定 error_reporting 指令,因为其无意义,实际等于 0。应该用相应的掩码值来替代。这些常量可以在 php.ini 中使用。

通过 Windows 注册表修改 PHP 配置

在 Windows 下运行 PHP 时,可以用 Windows 注册表以目录为单位来修改配置。配置值存放于注册表项 HKLM\SOFTWARE\PHP\Per Directory Values 下面,子项对应于路径名。例如对于目录 c:\inetpub\wwwroot 的配置值会存放于 HKLM\SOFTWARE\PHP\Per Directory Values\c\inetpub\wwwroot 项下面。其中的设定对于任何位于此目录及其任何子目录的脚本都有效。项中的值的’名称是 PHP 配置指令的名字,值的数据是字符串格式的指令值。值中的 PHP 常量不被解析。不过只有可修改范围是 PHP_INI_USER 的配置值可以用此方法设定,PHP_INI_PERDIR 的值就不行。

其它接口下的 PHP

无论怎样运行 PHP,都可以在脚本中通过 ini_set() 而在运行时修改某个值。更多信息见手册中 ini_set() 的页面。

如果对自己系统中的配置设定及其当前值的完整列表感兴趣,可以运行 phpinfo() 函数并查看其结果的页面。也可以在运行时用 ini_get() 或 get_cfg_var() 取得个别配置指令的值。

add a note add a note

User Contributed Notes 13 notes

up

down

3 Anteaus ?2 years ago

One of the most serious problems here is that it is hard to determine programmatically which of three or more possible configuration methods (php.ini, .user.ini, .htaccess) should be used on any given hosting company’s server.

The worst outcome is if an install.php routine attempts to set .htaccess directives on a cgi-mode server, in which case the outcome is usually a ‘500’ crash. Once in that situation the php installation routine cannot be rerun to correct the problem, so you effectively have a hosting lockout situation which can only be corrected by manual intervention.

up

down

-2 contrees.du.reve at gmail dot com ?9 years ago

Being able to put php directives in httpd.conf and have them work on a per-directory or per-vitual host basis is just great. Now there’s another aspect which might be worth being aware of:

A php.ini directive put into your apache conf file applies to php when it runs as an apache module (i.e. in a web page), but NOT when it runs as CLI (command-line interface).

Such feature that might be unwanted by an unhappy few, but I guess most will find it useful. As far as I’m concerned, I’m really happy that I can use open_basedir in my httpd.conf file, and it restricts the access of web users and sub-admins of my domain, but it does NOT restrict my own command-line php scripts…

up

down

-3 nick at vistaworks dot net ?4 years ago

On Windows, as the documentation above states, you cannot set max_upload_filesize and post_max_size in the registry, because they are PHP_INI_PERDIR.

Confusingly, however, is the fact that phpinfo() will show your changes if you do add those to the regsitry, as if they were taking effect. However, the upload size is *not* changed, regardless of what phpinfo() reports.

I believe the reading of registry values and override happen ‘too late’ in the request processing, ie, after the file has already been uploaded and rejected.

In a perfect world, phpinfo() would recognize this and not report the overridden values, which is very confusing.

up

down

-4 Woody/mC ?9 years ago

@ pgl: As the documentation says:

“To clear a previously set value use none as the value.”

Works fine for me.

up

down

-6 user at NOSPAM dot example dot com ?5 years ago

PHP Constants will work with php_value; for example:

apache配置支持php的时候总是出错!求大神帮助~成功加悬赏

httpd.conf这个配置文件里面加入

LoadModule php5_module “F:\web\PHP\php5apache2.dll”

AddType application/x-httpd-php .php

添加这2行,第三行去掉,然后保存,再重启下apache服务。

急啊,怎样让apache支持php

首先你要有PHP的执行程序,已经安装。

然后打开httpd.conf 找到有一堆LoadModule 的地方,在最后一个LoadModule下面增加如下配置:

LoadModule php5_module “${path}/php/php5apache2_2.dll”

PHPIniDir “${path}/”

SetEnv TMP “${path}/tmp”

注意其中:

第一行的${path}要换成你的PHP5的安装目录

第二行的${path}要换成你的php.ini文件所在的目录

第三行的${path}要换成你指定的PHP的临时目录

centos下如何设置让apache支持php

编译安装php,并且把php模块放到apahce里,然后apache conf中添加php模块配置

apache要开启模块加载模式

#./configure –prefix=/usr/apache2 –enable-module=so –enable-ssl

配置文件加入

LoadModule php5_module modules/libphp5.so

php编译模块到modules目录下

#./configure –prefix=/usr/php5 –with-apxs2=/usr/apache2/bin/apxs –with-mysql=/usr/mysql –with-curl=/usr/include/curl –with-zlib –with-gd –enable-mbstring

原创文章,作者:小蓝,如若转载,请注明出处:https://www.506064.com/n/153742.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
小蓝小蓝
上一篇 2024-11-15 03:23
下一篇 2024-11-15 03:23

相关推荐

  • PHP和Python哪个好找工作?

    PHP和Python都是非常流行的编程语言,它们被广泛应用于不同领域的开发中。但是,在考虑择业方向的时候,很多人都会有一个问题:PHP和Python哪个好找工作?这篇文章将从多个方…

    编程 2025-04-29
  • PHP怎么接币

    想要在自己的网站或应用中接受比特币等加密货币的支付,就需要对该加密货币拥有一定的了解,并使用对应的API进行开发。本文将从多个方面详细阐述如何使用PHP接受加密货币的支付。 一、环…

    编程 2025-04-29
  • 使用PHP foreach遍历有相同属性的值

    本篇文章将介绍如何使用PHP foreach遍历具有相同属性的值,并给出相应的代码示例。 一、基础概念 在讲解如何使用PHP foreach遍历有相同属性的值之前,我们需要先了解几…

    编程 2025-04-28
  • Apache配置Python环境

    Apache是一款流行的Web服务器软件,事实上,很多时候我们需要在Web服务器上使用Python程序做为数据处理和前端网页开发语言,这时候,我们就需要在Apache中配置Pyth…

    编程 2025-04-28
  • PHP获取301跳转后的地址

    本文将为大家介绍如何使用PHP获取301跳转后的地址。301重定向是什么呢?当我们访问一个网页A,但是它已经被迁移到了另一个地址B,此时若服务器端做了301重定向,那么你的浏览器在…

    编程 2025-04-27
  • Apache伪静态配置Java

    本文将会从多个角度阐述如何在Apache中正确伪装Java应用程序,实现URL的静态化,提高网站的SEO优化和性能。以下是相关的配置和代码实例。 一、RewriteEngine的配…

    编程 2025-04-27
  • PHP登录页面代码实现

    本文将从多个方面详细阐述如何使用PHP编写一个简单的登录页面。 1. PHP登录页面基本架构 在PHP登录页面中,需要包含HTML表单,用户在表单中输入账号密码等信息,提交表单后服…

    编程 2025-04-27
  • 如何解决org.apache.tomcat.util.net.nioendpoint套接字处理器出错?

    org.apache.tomcat.util.net.nioendpoint套接字处理器一般是指Tomcat服务器的套接字处理器,在Tomcat服务器中占据着非常重要的位置。如果出…

    编程 2025-04-27
  • PHP与Python的比较

    本文将会对PHP与Python进行比较和对比分析,包括语法特性、优缺点等方面。帮助读者更好地理解和使用这两种语言。 一、语法特性 PHP语法特性: <?php // 简单的P…

    编程 2025-04-27
  • nginx与apache应用开发详解

    一、概述 nginx和apache都是常见的web服务器。nginx是一个高性能的反向代理web服务器,将负载均衡和缓存集成在了一起,可以动静分离。apache是一个可扩展的web…

    编程 2025-04-25

发表回复

登录后才能评论