Articles of PHP

PHP脚本不能从子目录执行

这是情况。 我已经在运行Ajenti的ubuntu 14.04虚拟机上安装了prestashop 1.7.1,所以我的php-fpm和nginx。 看了很多教程和一些自定义configuration后,我设法让一切正常工作。 然而,我只是安装了一个新的模块,当调用的PHP文件,工作(生成XML)我服务的文件,而不是proccessed结果。我检查了文件的权限,我什至尝试所有文件777。 我已经注意到问题出在哪,yginx的configuration是: set $admin_dir /admin_folder; gzip on; gzip_vary on; gzip_proxied any; gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; # Supposed to be the case but we never know # text/html; gzip_disable "MSIE […]

php-fpm不能用于nginx重写

我试图重写到一个PHP文件在Nginx中没有改变的URL,但PHP-FPM没有处理文件,我得到的是一个500。 如果我删除重写并直接访问文件,它的工作原理,所以.php文件没有错。 server { listen 80; root /var/www/example.com/public_html; server_name example.com www.example.com; index index.html index.php; add_header Access-Control-Allow-Origin *; location ~ ^/InfoCenter/api/.*$ { rewrite "/InfoCenter/api/(.*)" /InfoCenter/api/index.php last; } location / { try_files $uri $uri/ =404; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/run/php/php7.0-fpm.sock; include fastcgi_params; } location ~/\.htaccess { deny all; } }

如何使用CDN加速简单的video网站与PHPdynamic加载video文件,如Moodle?

我用Moodle创build了一个网站,对于存储在服务器上的video文件的连接速度不是很满意。 而且我知道CDN可以加速video文件的加载速度。 但是我很新,对CDN不太熟悉。 我只希望任何访问video的人都必须login到我的源网站。 但是我听说CDN只能加速静态文件。 video文件的url是https://example.com/my.php/110/mod_page/content/2/543.mp4 如果没有login,则无法访问。 那么CDN可以获取mp4文件吗? 只会加速域名的工作?

如何修复“SCRIPT_NAME”而使用php-cgi运行php脚本?

我正在尝试使用腻子在WordPress中运行下面的PHP文件。 php-cgi -f info.php 但是这个命令会抛出这个错误的未定义索引:SCRIPT_NAME。 服务器设置: #fastcgi_param HTTPS $fastcgi_https; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; 请帮我解决这个问题。

Nginx重写子页面为主页面(laravel)

我在我的网站上有一个页面: http : //example.com/sub-page 我想要访问时看到该页面: http : //example.com/ 该网站是一个dynamic的PHP页面(laravel站点),需要在nginx中configuration如下: location / { try_files $uri $uri/ /index.php$is_args$args; } 我最后尝试使用rewrite ^/$ /sub-page last; 在上面的位置块,但它不按预期工作。 我怎样才能做到这一点?

NGINX试图下载PHP文件

我试图让Mantis使用来自官方Arch仓库(Mantis来自AUR)的php-fpm在NGinx上运行。 每当我去服务器地址(192.168.1.x),我被要求下载在目录的根目录的admin文件夹中的install.php文件。 这是我的nginx.conf: user http; worker_processes auto; worker_cpu_affinity auto; #pcre_jit on; events { worker_connections 2048; } http { include mime.types; default_type application/octet-stream; # sendfile on; # tcp_nopush on; send_timeout 20; # aio threads; server_tokens off; # Security: Disables nginx version in error messages and in the “Server” response header field. charset utf-8; # Force usage […]

什么是大的realpath_cache_ttl设置的缺点?

我一直在研究和调整realpath_cache_size和realpath_cache_ttl ,但是我不清楚如果我把realpath_cache_ttl设置得太高会带来什么后果。 该文档声明如下: 为其caching给定文件或目录的实时path信息的持续时间(以秒为单位)。 对于很less更改文件的系统,请考虑增加值。 好的,太好了。 我可以增加多less? 如果我增加太多会发生什么? 我能增加太多吗? 另外,如果有问题,我正在使用PHP 7 FPM,但我想了解realpath_cache_ttl大值是否也会影响非FPM安装。

phplist不断redirect到login页面

我一直遇到安装phplist的麻烦。 我以前使用过这个软件,但是这是一个在centos 7机器上的新安装。 添加一个安装数据库驻留并将正确的文件放在适当的位置后,我导航到设置页面,点击链接初始化数据库会发送一个消息,指出我的会话令牌是无效的。 然后我回到初始化数据库链接的设置页面。 将链接复制/粘贴到地址栏中,但在访问该页面之前删除该标记。 数据库设置,我设置我的用户名和密码等安装完成后我login。然后,当我点击pipe理面板中的任何链接,我redirect到login页面。 我可以重新login,但同样的情况一遍又一遍地发生。 数据库设置完成后,在login后删除URL中的标记无助。 我检查了错误日志,并没有显示在那里。 我正在运行centos 7,使用apache的php 5.6。

NGINX使用proxy_set_header主机$主机; 把我送到404

server { listen 80; server_name _; location /test/ { proxy_pass http://example.com/page.php; } } 目前,当我使用这个Nginx反向代理时,当我从test.com/test/访问时,它服务于我https://example.com/page.php但url保持不变。 当我调用$_SERVER['http_host'] ,它会返回example.com的主机名,而不是我发出请求的主机名(域中的url)。 我试过使用: proxy_set_header Host $host; 但是,这导致我运行后,404页面。 简而言之, 我想访问test.com/test并获得http://example.com/page.php, but have the when I call在PHP when I call $ _SERVER` when I call of test.com/test but have the主机名 编辑: events { worker_connections 1024; } http { sendfile on; tcp_nopush on; tcp_nodelay […]

在Windows上安装Composer

在Windows服务器上使用composer-setup.exe安装程序安装Composer。 但是,这个安装程序要求服务器能够通过getcomposer.org来获取文件。 由于我正在使用的服务器是一个没有广域网访问的内部系统,有没有人知道使用“离线”方法安装composer php的方式? 我所研究的一切都没有显示出这样的select。