Tag Archives: php

Primary script unknown error in php-fpm httpd rewrite

If you had something like this:
ProxyPassMatch “^/(.*\.php(/.*)?)$” “unix:/var/run/php-fpm/php.sock|fcgi://localhost/some/path” enablereuse=on

Advice is to change to SetHandler:


<Directory "/some/path">
<FilesMatch \.php$>
ProxyErrorOverride on
SetHandler "proxy:unix:/path/to/sock/php.sock|fcgi://localhost"
</FilesMatch>
</Directory>

debian 8 install php 7.1

apt-get install apt-transport-https lsb-release ca-certificates
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list
apt-get update

apt-get install php7.1
apt-get install php7.1-cli php7.1-common php7.1-curl php7.1-gd php7.1-json php7.1-mbstring php7.1-mysql php7.1-opcache php7.1-readline php7.1-xml

Failed to load resource: the server responded with a status of 405 (Method Not Allowed)

[allowmethods:error] [pid 688212:tid 139871391713024] [client xx.xx.xx.xx:41682] AH01623: client method denied by server configuration: ‘PATCH’

this means server do not support PATCH, if this id directadmin server:

cd /usr/local/directadmin/custombuild
./build set http_methods GET:HEAD:POST:PUT:DELETE:PATCH
./build rewrite_confs

remi install php55

Replacement of default PHP by version 5.6 installation (simplest):
yum-config-manager --enable remi-php56
yum update

Parallel installation of version 5.6 as Software Collection (x86_64 only):
yum --enablerepo=remi install php56

Replacement of default PHP by version 5.5 installation (simplest):
yum-config-manager --enable remi-php55
yum update

Parallel installation of version 5.5 as Software Collection (x86_64 only):
yum --enablerepo=remi install php55

Install it or recompile php without –disable-phar

It means you are missing phar extension, you will face this error until php will show:

php -i | grep phar –color=always

Registered PHP Streams => https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, zip, phar
Phar-based phar archives => enabled
Tar-based phar archives => enabled
ZIP-based phar archives => enabled
phar.cache_list => no value => no value
phar.readonly => On => On
phar.require_hash => On => On

php check port

$host = 'stackoverflow.com';
$ports = array(21, 25, 80, 81, 110, 443, 3306);

foreach ($ports as $port)
{
$connection = @fsockopen($host, $port);

if (is_resource($connection))
{
echo '

' . $host . ':' . $port . ' ' . '(' . getservbyport($port, 'tcp') . ') is open.

' . "\n";

fclose($connection);
}

else
{
echo '

' . $host . ':' . $port . ' is not responding.

' . "\n";
}
}