Articles of PHP5

当PHP在后台运行时找不到404 – Nginx

我注意到,即使脚本在后台工作,调用.php文件时也会得到404 – Not Found。 PHP文件下载一个长的JSON,并填充一个数据库,直到我closures窗口。 我正在使用PHP 5和Nginx 1.9.3。 我该如何解决这个问题,这是一个configuration问题? 感谢您的时间。 编辑 这个问题只发生在很长的JSON中。 我正在testing本地主机,我会在testing后格式化这个安装。 示例url: http://localhost/php/get_visit_log.php configuration:这里有一些截图。

PHP无法加载dynamic库的库

我一直试图让imagick在一个普通的灯服务器上工作。 我做了什么: sudo apt-get –purge remove "imagemagick" sudo apt-get –purge remove "php5-imagick*" service apache2 restart (lib not loaded anymore) sudo apt-get install imagemagick && php5-imagick sudo php5enmod imagick sudo service apache2 restart PHP信息告诉lib被加载,但是apache错误日志被垃圾邮件发送,每个请求都有以下内容: PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/imagick.so' – liblcms2.so.2: cannot open shared object file: No such file or directory […]

apache php-fpm:如何在不同用户的同一个域上运行脚本

我有一些包含PHP脚本的目录需要作为单独的用户运行。 示例目录结构如下所示: /var/www ├── project │ ├── item1 │ │ └── script1.php │ ├── item2 │ │ └── script2.php │ └── index.php 我可以通过使用单独的虚拟主机将它们作为单独的池运行。 哪里foo.com – > item1和bar.com – > item2 即 <VirtualHost *:80> ServerName foo.com DocumentRoot /var/www/project/item1 … <IfModule mod_fastcgi.c> AddType application/x-httpd-fastphp5 .php Action application/x-httpd-fastphp5 /php5-fcgi Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi-item1 FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi-item1 -socket /var/run/php5-fpm-item1.sock -pass-header Authorization […]

PHP脚本发送垃圾邮件和mail.add_x_header不起作用

最近我的服务器遭到了一些Php64恶意软件的攻击。 从那以后,我在/ var / www子文件夹中find了很多PHP文件。 我试图删除这些文件中的每一个,或者在文件的顶部(通常)添加了一些代码时清除这些文件。 当然,我知道我应该从头开始,一个新的wordpress安装和旧的安全备份,但这将是太多的工作,我的客户不会明白,他必须再次做所有的网页… 所以当我的一些PHP脚本仍然有很多垃圾邮件从我的服务器上传出时,我在我的debian服务器上的/ etc / php5 / apache2中将mail.add_x_header添加到了我的php.ini中,但是仍然没有显示哪个脚本正在使用邮件命令。 我几次重新启动Apache服务器,但没有喜悦。 任何方式,黑客可能已经保护该function工作,或者我错过了什么? 任何帮助将不胜感激。 提前致谢。 祝好,朱利安。

用IBM DB2 for PDO编译PHP 5.5.7

我试图在Ubuntu 12.04上编译PHP 5.5.7,并启用ubuntu精确合作伙伴库,以允许从db2exc包安装IBM DB2。 当我用pdo ibmconfigurationPHP时 source /home/db2inst1/sqllib/db2profile ./configure –prefix=/opt/php –enable-mbstring –enable-bcmath –enable-pcntl –enable-exif –enable-calendar –enable-opcache –enable-pdo –enable-sysvmsg –enable-sysvsem –enable-sysvshm –enable-wddx –with-curl –with-mcrypt –with-iconv –with-openssl –with-gettext=/usr –with-ibm_db2=/opt/ibm/db2/V9.7 –with-pdo-ibm=/home/db2inst1/sqllib 我得到这个警告: configure: WARNING: unrecognized options: –with-pdo-ibm http://php.net/manual/en/ref.pdo-ibm.php 编译后,它不起作用: $conn = new PDO("ibm:DEVELOP", "db2inst1", "ibmdb2", [ PDO::ATTR_PERSISTENT => TRUE, PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION ] ); PHP致命错误:在/home/vagrant/test/pdo_ibm.php:9中,带有消息“'找不到驱动程序”的未捕获exception'PDOException' 使用db2_connect可以正常工作: $conn = […]

端口80上的hhvm绑定阻止nginx绑定到该端口

我使用以下server.iniconfiguration在ubuntu14上运行hhvm: server.ini ; php options pid = /var/run/hhvm/pid ; hhvm specific ;hhvm.server.port = 9000 hhvm.server.file.socket=/var/run/hhvm/hhvm.sock hhvm.server.type = fastcgi hhvm.server.default_document = index.php hhvm.log.use_log_file = true hhvm.log.file = /var/log/hhvm/error.log hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc 我注释了9000端口行,并添加了文件套接字选项。 这个改变后,当我重新启动服务,似乎hhvm似乎绑定在端口80(我试图在端口80上运行nginx)。 我找不到任何hhvm的configuration,它显式绑定在端口80上。关于如何确保hhvm不使用端口80的任何想法。 php.ini中 ; php options session.save_handler = files session.save_path = /var/lib/hhvm/sessions session.gc_maxlifetime = 1440 ; hhvm specific hhvm.log.level = Warning hhvm.log.always_log_unhandled_exceptions = true […]

下载被截断(TCP连接终止)原因不明

在PHP中,我基本上有以下几点: set_time_limit(0); foreach ($files_to_send as $file) { $filesize = filesize($file); $blocksize = 1024 * 1024; // 1MB $outputted = 0; // how many bytes already sent $fid = fopen($file, 'r'); while ($outputted < $filesize) { echo fread($fid, $blocksize); $outputted += $blocksize; } } 这很好。 这是一个非常慢的服务器(英特尔凌动双核CPU),但从本地运行wget约20-24MB /秒。 从外部下载基本上填充服务器的上传速度或客户端的下载速度,以较慢者为准。 如预期的那样,500MB的下载需要大约8分钟的10mbps连接。 来自美国的人(服务器在荷兰阿姆斯特丹附近)提到,对他来说下载大约半分钟后就下载了。 他的下载速度大约是100-200KB / s,并且先不下滑。 我正在尝试诊断问题。 我已经检查了Apache的内存使用情况,并且非常稳定,这意味着PHP的输出( echo […]

使用Apache 2.4的php5.6-fpm在Ubuntu 14.04上显示php源代码

我的Ubuntu Vagrant显示PHP源代码,而不是解释PHP脚本。 我究竟做错了什么? 我的apache.conf: <Directory /> Options FollowSymLinks AllowOverride None </Directory> 我的虚拟主机configuration:ServerName kunstmaan.cms DocumentRoot "/var/www/logus/web" AllowOverride All Require all granted (…) </Directory> 服务-CGI-bin.conf <IfModule mod_alias.c> <IfModule mod_cgi.c> Define ENABLE_USR_LIB_CGI_BIN </IfModule> <IfModule mod_cgid.c> Define ENABLE_USR_LIB_CGI_BIN </IfModule> <IfDefine ENABLE_USR_LIB_CGI_BIN> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Require all granted </Directory> </IfDefine> </IfModule> /etc/apache2/conf-enabled/php5-fpm.conf […]

URL /dash/dash.m4s不允许MPEG-DASH服务器405错误PUT

我正在尝试在Ubuntu 16.04上构build一个MPEG-DASH服务器。 我安装了Apache和PHP,但是每次我尝试将文件放在来自编码器的段的专用文件夹中时,我收到错误:请求的方法PUT不允许URL /短划线/ 我把这个添加到/etc/apache2/mods-available/userdir.conf文件中,也添加到/etc/apache2/apache2.conf文件中。 但问题仍然存在: <Directory /var/www/html/dash/> AllowOverride All <Limit GET POST PUT HEAD OPTIONS> Require all granted </Limit> <LimitExcept GET POST PUT HEAD OPTIONS> Require all denied </LimitExcept> </Directory> 我看不到的是,事实上,也许我需要authentication的地方,让文件放在Apache服务器上? 我很新的Apache,所以我想了解如何PUT方法实际工作。 要提到的是,编码器和Apache服务器都在同一个子网上。 有任何想法吗 ? 谢谢 !

缺lessPHP gd的JPEG图像支持

我有一个centos 7服务器,需要多个版本的PHP。 我正在编译PHP 5.6和PHP应用程序需要支持GD Jpeg。 我有以下错误。 ./configure –prefix=/opt/php-5.6.28 …. –with-freetype-dir –with-freetype-dir –with-gd –enable-gd-native-ttf –with-png-dir –with-jpeg-dir=/usr/local/lib/ –with-jpeg-dir = / usr / local / lib / 或 / usr 或 / usr / lib64 .. 输出: checking for GD support… yes checking for the location of libvpx… no checking for the location of libjpeg… /usr/local/lib/ checking for […]