Articles of PHP

所有PHP会话都从Apache中删除

昨天我们遇到了一个奇怪的问题。 我们有我们的应用程序在Apache服务器上托pipe的PHP。 突然间,我们所有的用户都从应用程序中注销。 在Apache日志中,我们没有发现任何日志条目以及5-10分钟。 我们不确定所有PHP会话如何被删除。 可能吗? 我们的监测显示当时的磁盘空间利用率在90%以上。

不能curl到NodeJS,但可以从浏览器访问它

我可以从浏览器访问我的testing节点站点( http://18.220.168.1:8888 )就好了。 但是,当我尝试使用PHP的cURLcurl时,我得到: Array ( [curl_error] => Failed to connect to 18.220.168.1 port 8888: Connection refused [error_number] => 7 ) 我的cURL设置是: $ch = curl_init($url); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); // Temporary for testing self-signed sites curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: '.$data_type, 'Content-Length: […]

fedora 27 httpd 500错误

我只是将我的fedora从26升级到了27。我注意到的第一件事是我用于testing的本地Apache服务器返回500错误。 这是我的httpd.conf标记我的虚拟主机的部分 <VirtualHost *:80> # Admin email, Server Name (domain name) and any aliases ServerAdmin [email protected] ServerName social.loc ServerAlias social.loc # Index file and Document Root (where the public files are located) DirectoryIndex index.php DocumentRoot /var/www/html/social/public_html <Directory "/var/www/html/social/public_html"> Options FollowSymLinks AllowOverride All Order allow,deny Allow from all </Directory> # Custom log file locations LogLevel warn […]

如何在与docker-compose链接到另一个容器的容器中运行linux守护进程?

免责声明:我在这里发布这个,因为人们开始投票closures这个问题作为“脱离主题”。 虽然有些人认为Docker问题应该在SO上发布,而不是SF,但是其他人却相反。 我有以下docker-compose.yml文件,它运行带有PHP支持的nginx: version: '3' services: nginx: container_name: my-app-nginx image: nginx:1.13.6 ports: – 8080:80 volumes: – ./nginx-default.conf:/etc/nginx/conf.d/default.conf – ./my-app:/var/www/my-app restart: always depends_on: – php php: container_name: my-app-php image: php:7.1-fpm volumes: – ./my-app:/var/www/my-app restart: always /var/www/my-app的PHP应用/var/www/my-app需要与一个linux守护进程进行通信(我们称之为myappd )。 我看到的方式,我需要: 把myappd复制到/usr/local/bin的nginx容器中,用chmod +x使其可执行,并在后台运行。 创build一个不同的容器,将myappd复制到/usr/local/bin ,使用chmod +x使其可执行,并在前台运行它。 现在,我是Docker的新手,我正在研究和了解它,但是鉴于我在使用Docker Composer,我的最佳猜测是选项2可能是推荐的选项? 鉴于我对Docker的知识有限,我不得不猜测这个容器需要某种基于Linux的映像(比如Ubuntu或者其他)来运行这个二进制文件。 所以也许选项1是首选? 或者,也许选项2是可能的一个最小的Ubuntu图像,也许没有这样的形象是可能的? 无论哪种方式,我不知道如何在composer文件上实现它。 特别是选项2,PHP应用程序将如何与守护程序在不同的容器中进行通信? 就像我为nginx / php服务所做的那样,“共享”一个卷(二进制文件所在的位置)就足够了吗? 还是其他什么是必需的?

即使端口打开,也不能连接到PHP TCP / IP服务器?

我有一个活的服务器(Ubuntu 14.04,运行一个LAMP堆栈),这工作正常。 最近,我添加了一个使用PHP代码的TCP / IP服务器。 这是我使用的代码。 请注意,IP地址是一个占位符: <?php error_reporting(E_ALL); /* Allow the script to wait for connections. */ set_time_limit(0); /* Activate the implicit exit dump, so we'll see what we're getting * while messages come. */ ob_implicit_flush(); $address = '123.456.789.123'; $port = 1235; if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) === false) { echo "socket_create() failed: […]

PHP不工作在Ubuntu上的虚拟域

我正在使用ubuntu服务器上的apache2托pipe多个服务器(虚拟服务器)。php工作在默认服务器上,但不在虚拟服务器上。 我能做些什么来让PHP在虚拟服务器上工作

如何审计apache / php如果他们设置了一些安全漏洞

当你在php上安装新的系统时,你使用哪种方法来检查“未经授权的访问”,或系统外部发送信息? 我以为这些方法 1)searchfopen,file_put_contents,file_get_contents 2)searchcurlfunction 3)审计Apache日志 我们还能search什么?

limit_req,排除php文件和路由

我有一个脚本,显示图像,我试图从limit_req排除下面的PHP路线 rewrite ^/([^\@]*)\@(\d+x\d+)$ /index.php?route=image&action=show&path=$1&size=$2 break; 我有 location ~ .php$ { limit_req zone=req_limit_per_ip burst=3 nodelay; limit_conn conn_limit_per_ip 3; include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.1-fpm.sock; } 为我使用的图像和其他文件格式 location ~* ^.+.(jpg|jpeg|gif|png|svg|ico|css|less|xml|html?|swf|js|ttf)$ { expires 10y; } 所以如何从nginxconfiguration中的limit_req中排除路由(index.php?route = image)?

nginx规则为limit_req

几天后,我仍然试图限制除了一个请求。 我想排除包含“上传”的url,但我收到以下错误:nginx:[emerg]“limit_req”指令不允许在这里 location ~ .php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/run/php/php7.1-fpm.sock; if ($request_uri !~ "uploads") { limit_req zone=req_limit_per_ip burst=3 nodelay; limit_conn conn_limit_per_ip 3; } }

Apache和PHP的权限

我有一个服务器使用Ubuntu的服务器,与Apache2和PHP。 我想用一个php文件设置一个目录,这个目录在互联网上是可见的,而且在它的内部是一个私有的目录,没有人(apache)可以访问它,除了php文件。 我怎样才能做到这一点?