Articles of PHP5

Apache消耗太多的CPU和内存

我在使用Apache Web Server加载内存时遇到一些麻烦。 我们正在虚拟机上运行Ubuntu Server 12.04 LTS 。 我们的服务器有以下规格: 8GB内存; 4个vCPU( 12ghz ); 我们configuration服务器运行一个基于Drupal(7.23)的网站 。 所以,我们安装了Apache,PHP,MySQL …版本如下: Apache 2.2.22; PHP 5.3.10( PHP以Apache模块运行 ); APC 3.1.7; MySQL 5.5.31(所有innodb表); 我也运行一些Apache模块 。 看看( apachectl -M ): core_module(静态) log_config_module(静态) logio_module(静态) mpm_prefork_module(静态) http_module(静态) so_module(静态) actions_module(共享) alias_module(共享) authz_host_module(共享) deflate_module(共享) dir_module(共享) env_module(共享) include_module(共享) mime_module(共享) php5_module(共享) proxy_module(共享) proxy_http_module(共享) reqtimeout_module(共享) rewrite_module(共享) setenvif_module(共享) ssl_module(共享) status_module(共享) […]

在CentOS 6.5上将PHP 5.4降级到5.3?

我试图将PHP从5.5.8降级到5.3.x. 我已经尝试过,但它为我工作。 yum downgrade php 我得到的错误是 Loaded plugins: fastestmirror, refresh-packagekit, security Setting up Downgrade Process Loading mirror speeds from cached hostfile * Webmin: webmin.mirror.somersettechsolutions.co.uk * base: centos.excellmedia.net * epel: epel.mirror.net.in * extras: centos.excellmedia.net * updates: centos.excellmedia.net No Match for available package: php-5.3.3-26.el6.x86_64 Nothing to do 我也尝试过这个,但是即使这个力量也适合我。 sudo yum downgrade php php-common php-cli 我得到的错误日志是 Loaded plugins: […]

Apache:我如何通过PHP提供JavaScript?

我想通过PHP脚本来提供我的JavaScript文件。 一个例子是: 如果我要请求一个名为dir/my_file.js的JavaScript文件 服务器应该将请求redirect到名为my_script_server.php?src=dir/my_files.js的处理程序脚本my_script_server.php?src=dir/my_files.js 我如何在Apache中做到这一点?

Apache不显示PHP页面,而是提供它们下载

我们试图设置apache(在这种情况下,apache 2,尽pipeApache做同样的事情)和HTML页面显示得很好,但是,链接到首页button的任何PHP页面提供下载,而不是显示。 任何想法,我们已经错过了? 它的certificate很难在google上search,因为这些术语在其他地方被大量使用。 我知道这是一个普遍的,但我们已经尝试添加types到apache.conf(或apache1的httpd.conf)是没有任何喜悦的。 谢谢。 彼得。

我在哪里可以得到Windows的php_mysql.dll?

我只是在Windows XP上安装了Apache 2.2.17,PHP 5.2.14和MySQL 5.1.51。 Apache正在工作,正在加载PHP,但是当我尝试连接到MySQL,我得到“致命的错误:调用未定义的函数mysql_connect()”。 一些谷歌search后,我发现我需要加载php_mysql.dll扩展,这需要libmysql.dll。 我在MySQL发行版中find了libmysql.dll文件,但php_mysql.dll无处可查。 为什么不包含在PHP或MySQL? 我在哪里可以find它?

禁用DNScachingPHP

我需要在脚本中获取DNS的最新Alogging。 脚本正在做一些监视操作。 DNSlogging的默认TTL为5分钟,但监控脚本每分钟运行一次。 我正在使用PHP的函数dns_get_record来获得Alogging,但我想知道是否有一种方法,我可以忽略TTLcaching,并从DNS服务器获取logging,而不是caching。 当然,任何强制这样的方式,以便没有networking级别的caching是适用的,每次我运行脚本,它实际上命中DNS服务器? 感谢Sparsh Gupta

当试图安装pecl扩展时,在mac os x 10.7.3上出现$ PHP_AUTOCONF错误

我试图用pecl_http和memcache设置我的机器,在这两种情况下,我得到类似的错误。 这是在MAC OS X 10.7.3(狮子),我也有XCODE安装在它上面。 在运行这些命令之前,我还安装了Zend Server社区版本,并且设置了CFLAGS='-arch i386 -arch x86_64'环境variables集 bash-3.2# **sudo pecl install pecl_http-1.7.1** downloading pecl_http-1.7.1.tgz … Starting to download pecl_http-1.7.1.tgz (174,098 bytes) ……………………………….done: 174,098 bytes 71 source files, building running: phpize Configuring for: PHP Api Version: 20090626 Zend Module Api No: 20090626 Zend Extension Api No: 220090626 Cannot find autoconf. Please check your […]

如何禁止使用disable_functions?

我显然不是第一个有这个问题的人,但是我不能find这种情况的答案。 我想locking一点PHP,更具体地说是使用disable_functions。 环境是CentOS 6.2 / PHP 5.3.3 fcgid / Apache 2.2.15: 什么是正确的Apacheconfiguration(AllowOverride等)来禁用任何PHP设置通过.htaccess更改 ? 所有其他覆盖都可以(当前设置是AllowOverride All) 什么是正确的configuration禁止有效使用disable_functions除了主php.ini (如在禁止使用disable_functions在/ home / myvhost / etc / php5 / php.ini或任何目录内的该vhost public_html。另一种方式说这个:唯一有效的disable_functions来自主php.ini)? 如果#2是不可能的,至less是什么适当的configuration,以禁止虚拟主机有效地使用任何php.ini,但虚拟主主机 (/ 主机 / MyVhost / etc / php5 / php.ini )? 谢谢

安装了PHP5,但Apache将PHP显示为未解释的文本。 我怎样才能得到它来处理它作为PHP?

在Drupal安装中,它将在下面以纯文本forms显示根PHP文件。 a2enmod说php5是启用的,aptitude说libapache2-mod-php5已经安装,mods-enabled /有php5.conf和php5.load,VirtualHost有DirectoryIndex和ScriptHandler指定。 这有点像政府经济学家的计算机病毒:你可以find的每一个指标都说你的系统是好的,但是它不起作用。 我该怎么做才能让这个Drupal 7站点运行? 显示的页面是: <?php /** * @file * The PHP page that serves all page requests on a Drupal installation. * * The routines here dispatch control to the appropriate handler, which then * prints the appropriate page. * * All Drupal code is released under the GNU General Public License. […]

带有重音字母的path中的Apache + PHP

如果DOCUMENT_ROOT的path包含重音符号,我无法在Windows XP下的Apache下运行支持PHP的网站。 我不是指脚本文件名称本身,而是指path组件中的任何文件夹。 我有这个虚拟主机定义: <VirtualHost *:80> ServerName foo.local DocumentRoot "E:/gonzález/sites/foo" ErrorLog logs/foo.local-error.log CustomLog logs/foo.local-access.log combined <Directory "E:/gonzález/sites/foo"> AllowOverride All Options Indexes FollowSymLinks Order allow,deny Allow from all </Directory> </VirtualHost> 如果我用ANSI保存文件,我得到一个语法错误: DocumentRoot必须是一个目录 如果我用Unicode保存文件, 则会得到另一个语法错误: 无效命令'\ xff \ xfe#',可能是拼写错误,或者是由服务器configuration中未包含的模块定义的 (看起来像抱怨BOM) 如果我保存文件在无BOM的UTF-8 Apache工作正常,它提供的静态文件没有明显的问题… …但是,加载任何* .php文件(甚至是空的)的PHP投诉: Warning: Unknown: failed to open stream: No such file or directory in Unknown […]