Articles of PHP5

PHP无法连接到MySQL

我最近在我的Windows 7 64位机器上按照这个指南安装了Apache 2 + PHP 5.3.1 + MySQL 5.1.44: http ://sleeplessgeek.blogspot.com/2010/01/setting-up-apache-php-mysql-phpmyadmin html的 这一切都很好,PHP工作很好(即使与XDebug),但我无法连接到MySQL服务器。 我写的一个简单的脚本来testing连接(是的,根没有通过): $username = "root"; $password = ""; $database = "test"; $hostname = "localhost"; $conn = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL Database!!"); 它在60秒的超时后打印这个错误: 警告:mysql_connect()[function.mysql-connect]:连接尝试失败,因为连接方在一段时间后没有正确响应,或者由于连接的主机未能响应而build立连接失败。 我可以使用cmd> mysql -h localhost -u root连接到mysql 服务工作正常。 PhpMyAdmin似乎也有问题(使用3.2.5)。 只要我键入用户,并通过页面加载和变成空白(内容长度在标头为0,但状态码为302find)。 看起来像cookies(我的身份validation方法)有问题。 我希望有人有一个线索,它必须是愚蠢的简单,我错过了。 提前致谢。

Windows7 IIS7:拉链没有php5isapi.dll我可以使用php.dll吗?

该页面: 如何在IIS 7和Windows Vista (以及其他一些平台上) 上安装PHP 5.2引用了一个神秘的php5isapi.dll,它不在Windows安装目录或zip文件中: php-5.3.2-Win32-VC9-x86.zip – VC9 x86 Thread Safe php-5.3.2-nts-Win32-VC9-x86.zip – VC9 x86 Non Thread Safe 在stackoverflow另一个post说,它已经过时,并由“fastapi”取代,但没有说明提到这一点。 我确实在zip文件中find了一个php.dll。 我可以使用,而不是php5isapi.dll? 尝试在Windows上使用MySQL安装基本的PHP5是非常令人沮丧的。

PHP不加载目录中的php.ini或在Windows 7上的error_reporting()之后

通常我在E_ALL错误级别下开发,但为了这个项目的理智,我需要通知和严格的closures。 所以最初尝试: error_reporting(E_ALL & ~(E_STRICT|E_NOTICE)); 和其他几个相同的组合,没有任何工作。 接下来,我尝试创build一个php_ini的目录,但是error_reporting = E_ALL & ~E_NOTICE但是没有工作。 phpinfo()正在报告: Scan this dir for additional .ini files: (none) 有人可以帮我解决这些问题吗? 最好是两个! 谢谢! 我在Windows 7 x64的Apache / 2.2.14上运行PHP 5.2.13版。

反bot技术

我想为我的web应用程序做一些反bot技术的研究。 我意识到Captcha,但想探索一些其他的技术。 特别是,我希望用户在填写申请表之前访问所有页面。 我正在使用LAMP。 任何build议是最受欢迎的。 谢谢

mod-rewrite可以用来设置环境variables吗?

我有一个现有的简单的重写规则,如下所示: <Directory /path> RewriteEngine on RewriteBase / # if the requested resource does not exist RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d # route the uri to a front controller RewriteRule ^(.*)$ index.php/$1 [L] </Directory> 这工作正常,但我想做两件事情之一。 在检测客户端接受语言头的基础上,我也想 (i)将检测到的语言设置为脚本可以使用的环境variables (ii)重写请求,使url以语言代码开始(例如www.example.com/en/some/resource) 在实施(i)方面,我定义了这个规则: <Directory /path> RewriteEngine on RewriteBase / # if the requested resource does not exist RewriteCond %{REQUEST_FILENAME} […]

我在哪里可以findphp_mssql.dll?

我试图让PHP设置连接到SQL Server数据库。 我正在寻找php_mssql.dll文件放在我的扩展目录,但我的生活无法find它在线。 谁能帮忙?

为什么不会php 5.3.3在redhat ent上编译libphp5.so

我想从PHP 5.2.13升级到PHP 5.3.3。 但是,apache模块libphp5.so将不会被编译。 下面是我使用的configuration选项的输出。 configuration语句是我通常使用的简化版本。 ========== './configure''–disable-debug''–disable-rpath''–with-apxs2 = / usr / local / apache2 / bin / apxs' … ** ** **警告:不支持库间依赖关系。 ** ** **所有声明的库间依赖性都被丢弃。 ** ** **警告:libtool无法满足模块libphp5的所有声明的库间** ** **依赖关系。 因此,libtool将创build一个静态模块,只要dopingning ** ** **应用程序与-dlopen标志链接,该模块就会工作。 复制选定的目标文件以避免基名冲突…生成phar.php生成phar.phar PEAR包未安装PHP_Archive:生成的phar将需要启用PHP的phar扩展。 clicommand.inc pharcommand.inc directorytreeiterator.inc directorygraphiterator.inc invertedregexiterator.inc phar.inc build立完整。 不要忘记运行“testing”。 ============= PHP 5.2.13重新编译就好,所以5.3.3。 任何帮助将不胜感激!!

www-data用户似乎没有使用php-curl的权限

我试图让最简单的模块为drupal工作,它依靠php-curl来获取它的请求。 当我作为用户root做下面的工作正常: root@server:~# php -a Interactive mode enabled <?php $ch = curl_init("http://testsite.drupal.dev/user"); $fp = fopen("example.html", "w"); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); curl_close($ch); fclose($fp); ?> root@server:~# cat /root/example.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!– Blah Blah –> </body> </html> root@server:~# 但是,当www数据用户这样做,它会失败: root@server:~# su – www-data www-data@server:~$ php5 -a Interactive mode enabled […]

我如何连接Apache2和PHP5?

我试图在运行Ubuntu 10.10的服务器上安装LAMP堆栈。 每当我浏览到服务器上的PHP文件,我的浏览器将下载一个名为“下载”(没有扩展名)的文件。 我已经安装了php5,我有libapache2-mod-php5,我已经清理并重新安装了很多次,没有任何帮助。 我能做什么? 如有必要,我可以提供configuration文件,系统信息等。

安装了PHP模块,但没有出现在phpinfo()

试图在我的Ubuntu服务器上安装php5-ffmpeg模块。 我input了: sudo apt-get install php5-ffmpeg 一切安装完毕,Web服务器重新加载。 现在,下面的行被添加到在phpinfo()中Additional .ini files parsed中: /etc/php5/apache2/conf.d/ffmpeg.ini 但是,在phpinfo()中不存在关于ffmpeg模块的更多信息,而ffmpeg函数在脚本中不起作用。 这里是ffmpeg.ini文件的内容: ; configuration for the ffmpeg-php module extension=ffmpeg.so ; Turn ffmpeg warnings into PHP warnings ;ffmpeg.show_warnings=0 ; Persistent movies ;ffmpeg.allow_persistent=0 PHPInfo屏幕截图: http ://i050.radikal.ru/1011/41/021944f4f1c4.png Apache错误日志显示: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/ffmpeg.so' – /usr/lib/php5/20090626+lfs/ffmpeg.so: cannot open shared object file: No […]