Articles of PHP

configurationPHP MySql扩展

我正在尝试为PHP开发加载一个MySql扩展。 运行<?php phpinfo(); ?> <?php phpinfo(); ?>我可以看到MySql扩展没有加载。 运行使用mysql_connect函数并接收到错误Fatal error: Call to undefined function mysql_connect() in C:\Apache24\htdocs\test.php on line 11的脚本时,这也很明显Fatal error: Call to undefined function mysql_connect() in C:\Apache24\htdocs\test.php on line 11 。 运行php –ini我收到一个输出: Loaded Configuration File: C:\php\php.ini Scan for additional .ini files in: (none) Additional .ini files parsed: (none) 所以当我编辑我的php.ini文件为了启用MySql扩展我知道我正在编辑正确的.ini文件。 phpinfo()的输出指向同一个文件。 在我的php.ini文件中,我改变了 ;extension=php_mysql.dll 至 extension=php_mysql.dll […]

在Windows Server上debugging由本地系统帐户执行的缓慢的“git pull”操作

在运行Apache和PHP的Windows服务器上,Web服务器通过PHP脚本执行git pull 。 这是部署过程的一部分。 当Apache2服务在本地系统帐户下运行时,PHP中的exec("git pull")非常缓慢,有时永远不会完成。 当它以pipe理员身份运行时,情况并非如此。 除拉之外的Git操作并不慢。 因此,我怀疑一些SSH /networking问题处于危险之中。 但是,我不知道一种方法来debugging。 因此,如何find导致这个问题的原因呢? 或者,对于可能的原因有什么build议?

无法find司机灯debian

这是我的PHP示例脚本: <?php try{ $db=new PDO('mysql:dbname=_mydb;host=localhost', 'root', 'xxxxxx'); }catch(PDOException $e) { echo "Error: ".$e->getMessage(); } ?> 我回来了: could not find driver 也: user@nbook:~$ php -i|grep PDO PDO PDO support => enabled PDO drivers => mysql PDO Driver for MySQL => enabled 这是我的phpinfo: PHP Version 5.6.9-0+deb8u1 System Linux nbook 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1 (2015-05-24) x86_64 Build […]

在cPanel Nginx混合VPS上的WordPress网站内存不足

我有一个cPanel混合VPS下面是规格: CPU(16核Xeon)专用 4GB保证内存(专用) 6GB可分配RAM 1Gbps端口速度 安装了cPanel和NginxCP 所有使用WordPress的服务器上的站点都不会显示以下错误消息 致命错误:内存不足(分配3407872)(试图分配3200字节)在/ home / * / public_html / wp-includes / …….. 尝试解决问题的步骤。 在PHPconfiguration中将memory_limit升级到128M和256M 在wp-config.php中升级内存 通过FTP手动上传wordpress文件 从服务器删除NginxCP和Nginx 没有上述解决scheme的工作。

在CentOS上安装PHP 5.3.3的Zend Server

我有两个Linux服务器 CentOS 6.5 CentOS 6.6 我有这些服务器上的PHP 5.3.3 我应该将Zend Server的哪个版本安装到这些服务器上?

在NGINX和PHP-FPM升级之后,PHP停止工作,并且没有任何错误

PHP-FPM正在运行,NGINX正在运行。 NGINX确实读取了PHP-FPM的套接字​​。 我停止PHP-FPM,我得到了错误的网关错误。 但是,什么都不显示。 我已经检查了nginx / error.log和php5-fpm.log,并且没有错误。 我更改了PHP-FPM中的日志logging以查看正在发生的事情,并根据需要创buildsubprocess(pm = ondemand)。 这是我的php-fpm.conf: pid = /var/run/php5-fpm.pid error_log = /var/log/php5-fpm.log log_level = debug include=/etc/php5/fpm/pool.d/*.conf pool.d / www.conf(那里唯一的文件)[www] user = www-data group = www-data listen=/var/run/php5-fpm.sock listen.owner=www-data listen.group=www-data pm=ondemand pm.max_children=4 pm.start_servers=2 pm.min_spare_servers=1 pm.max_spare_servers=3 chdir=/ 这里是nginx.conf user www-data www-data; worker_processes 4; pid /run/nginx.pid; events { worker_connections 768; } http { client_max_body_size […]

什么是我的nginx + php服务器的瓶颈?

我在我的nginx服务器上运行一些攻击testing。 瓶颈似乎不是CPU或内存,那么它是什么? 我试图在我的MacBook上做到这一点: sudo siege -t 10s -c 500 server_ip/test.php 响应时间达到10秒,在完成之前我得到错误和围困中止。 但我如果在我的服务器上运行上述 siege -t 10s -c 500 localhost/test.php 我得到: Transactions: 6555 hits Availability: 95.14 % Elapsed time: 9.51 secs Data transferred: 117.30 MB Response time: 0.18 secs Transaction rate: 689.27 trans/sec Throughput: 12.33 MB/sec Concurrency: 127.11 Successful transactions: 6555 Failed transactions: 335 Longest transaction: 1.31 […]

AWS写入权限,httpd 2.4

amazon web services,服务器版本:Apache / 2.4.6(红帽企业Linux) apache日志报告: [Fri Aug 07 13:53:40.793562 2015] [:error] [pid 10730] [client 149.88.114.40:40800] PHP Warning: file_put_contents(./test.txt): failed to open stream: Permission denied in /var/www/html/vraim/index.php on line 18 这里是试图写入当前目录的PHP代码: <?php file_put_contents("./test.txt", "Test"); // <=== This cannot write!!! $uid = posix_getuid(); echo "PosixGetUID: " . $uid . "<br/>"; $userinfo = posix_getpwuid($uid); print_r($userinfo); ?> 目录上的权限: […]

如何编写多个mod重写规则?

我总是使用以下规则来pipe理url: Options +FollowSymLinks RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-d RewriteCond %{SCRIPT_FILENAME} !-f RewriteRule ^.*$ ./urlredirect.php 有了这个,我可以轻松地检查用户试图访问哪个网页。 现在我有一个网站,需要在所有网页上的https。 这是基本的解决scheme: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} 我现在的问题是,我不能同时工作。 我对mod重写和正则expression式知之甚less。 任何帮助将不胜感激。

PHP-FPM不能使用htaccess

我有一个VirtualHost : <VirtualHost *:80> DocumentRoot "/var/www/html/example.com" ServerName example.com ServerAlias *.example.com <Directory "/var/www/html/example.com"> Require all granted Options -Indexes +FollowSymLinks -ExecCGI AllowOverride All DirectoryIndex index.php <IfModule mod_proxy_fcgi.c> RewriteEngine On RewriteBase / RewriteOptions InheritBefore RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^([^\.]+\.php)$ fcgi://127.0.0.1:9000/var/www/html/example.com/$1 [L,P] </IfModule> </Directory> </VirtualHost> 还有位于/var/www/html/example.com/mysub/.htaccess的.htaccess文件。 在.htaccess文件里面,我有: Options -MultiViews RewriteEngine On RewriteBase /mysub Options +FollowSymLinks RewriteCond $1 !^(index\.php|assets|css|js|favicon\.ico|robots\.txt) RewriteCond […]