Switch to php56 using FPM+FastCGI

tags/0.3.0_0.fc26_el5
Daniel Berteaud 8 years ago
parent 024bea784e
commit 2b37f09ca2
  1. 2
      root/etc/cron.daily/pydio-indexer
  2. 9
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/68FastCGIConfig25Pydio
  3. 49
      root/etc/e-smith/templates/etc/httpd/conf/httpd.conf/98Pydio
  4. 55
      root/etc/e-smith/templates/etc/php-fpm.d/www.conf/25Pydio
  5. 2
      root/etc/e-smith/templates/var/lib/pydio/plugins/conf.serial/plugins_configs.ser/10All
  6. 13
      smeserver-pydio.spec

@ -31,7 +31,7 @@ foreach my $share ($a->get_all_by_prop(type => 'share')){
unlink </var/cache/pydio/indexes/.ajxp_lock-$name> unlink </var/cache/pydio/indexes/.ajxp_lock-$name>
if (time() - $mtime > 18000); if (time() - $mtime > 18000);
} }
system('/usr/bin/sudo -u www /usr/bin/php -d max_execution_time=3600 /usr/share/pydio/cmd.php ' . system('/usr/bin/sudo -u www /usr/bin/php__PHP_VERSION__ -d max_execution_time=3600 /usr/share/pydio/cmd.php ' .
'-u=RDiin175M40T0cYvXLARpAi+1TsSVkbksEDZ4KvwBuY= '. '-u=RDiin175M40T0cYvXLARpAi+1TsSVkbksEDZ4KvwBuY= '.
'-t=e71479ebc4365176d9f09fe957780024 -a=index '. '-t=e71479ebc4365176d9f09fe957780024 -a=index '.
'-r='.$name.' --secure_token='.$id.' --dir=/ --_method=put >/dev/null 2>&1'); '-r='.$name.' --secure_token='.$id.' --dir=/ --_method=put >/dev/null 2>&1');

@ -0,0 +1,9 @@
{
if ($fastcgi_mod eq 'mod_fastcgi'){
$OUT .=<<_EOF;
Action phppydio-fastcgi /php-cgi-bin/phppydio-wrapper
Alias /php-cgi-bin/phppydio-wrapper /var/www/php-cgi-bin/phppydio-wrapper
FastCgiExternalServer /var/www/php-cgi-bin/phppydio-wrapper -socket /var/run/php-fpm/php__PHP_VERSION__-pydio.sock -pass-header Authorization -idle-timeout 120
_EOF
}
}

@ -10,10 +10,44 @@ if (($pydio{'status'} || 'disabled') eq 'enabled'){
" AuthBasicProvider external\n" . " AuthBasicProvider external\n" .
" AuthExternal pwauth\n" . " AuthExternal pwauth\n" .
" Require valid-user\n" : ''; " Require valid-user\n" : '';
my $maxsize = $pydio{'MaxUploadSize'} || '200M'; my $maxsize = $pydio{'MaxUploadSize'} || '2048M';
my $homedir = $pydio{'HomeDir'} || 'none'; my $homedir = $pydio{'HomeDir'} || 'none';
$homedir = (($homedir eq 'enabled') || ($homedir eq 'users')) ? ":/home/e-smith/files/users":""; $homedir = (($homedir eq 'enabled') || ($homedir eq 'users')) ? ":/home/e-smith/files/users":"";
my $php =<<_EOF;
AddType application/x-httpd-php .php
php_admin_value open_basedir /usr/share/pydio:/var/lib/pydio:/var/log/pydio:/etc/pydio:/var/cache/pydio:/usr/share/pear/:/usr/share/php/:/home/e-smith/files/shares$homedir
php_admin_value memory_limit 100M
php_admin_value upload_max_filesize $maxsize
php_admin_value post_max_size $maxsize
php_admin_value max_execution_time 900
php_admin_value upload_tmp_dir /var/lib/pydio/tmp
php_admin_value session.save_path /var/lib/pydio/tmp
php_admin_flag output_buffering off
_EOF
my $pubphp=<<_EOF;
AddType application/x-httpd-php .php
_EOF
if ($fastcgi_mod eq 'mod_fastcgi'){
$php = "AddHandler phppydio-fastcgi .php\n";
$pubphp = $php;
}
elsif ($fastcgi_mod eq 'mod_proxy_fcgi'){
$php =<<_EOF;
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php-fpm/php__PHP_VERSION__-pydio.sock|fcgi://localhost"
</FilesMatch>
_EOF
$pubphp = $php;
}
my $shares = ''; my $shares = '';
my $public = $pydio{'PublicShares'} || 'enabled'; my $public = $pydio{'PublicShares'} || 'enabled';
@ -22,8 +56,7 @@ if (($pydio{'status'} || 'disabled') eq 'enabled'){
Alias /ajxppub /var/lib/pydio/public Alias /ajxppub /var/lib/pydio/public
<Directory /var/lib/pydio/public> <Directory /var/lib/pydio/public>
Options None Options None
AddType application/x-httpd-php .php $pubphp
php_admin_value open_basedir /usr/share/pydio:/var/lib/pydio:/var/log/pydio:/etc/pydio:/var/cache/pydio:/usr/share/pear/:/usr/share/php/:/home/e-smith/files/shares$homedir
Order deny,allow Order deny,allow
Allow from all Allow from all
<Files ".ajxp_*"> <Files ".ajxp_*">
@ -44,16 +77,8 @@ EOF
$alias $alias
<Directory /usr/share/pydio> <Directory /usr/share/pydio>
AddType application/x-httpd-php .php
php_admin_value open_basedir /usr/share/pydio:/var/lib/pydio:/var/log/pydio:/etc/pydio:/var/cache/pydio:/usr/share/pear/:/usr/share/php/:/home/e-smith/files/shares$homedir
php_admin_value memory_limit 100M
php_admin_value upload_max_filesize $maxsize
php_admin_value post_max_size $maxsize
php_admin_value max_execution_time 900
php_admin_value upload_tmp_dir /var/lib/pydio/tmp
php_admin_value session.save_path /var/lib/pydio/tmp
php_admin_flag output_buffering off
SSLRequireSSL on SSLRequireSSL on
$php
Order deny,allow Order deny,allow
Deny from all Deny from all
Allow from $allow Allow from $allow

@ -0,0 +1,55 @@
{
if ($PHP_VERSION eq '__PHP_VERSION__'){
if (($dl{'status'} || 'disabled') eq 'enabled'){
my $max_upload_size = $pydio{MaxUploadSize} || '4096';
$max_upload_size .= 'M' unless ($max_upload_size =~ m/[MG]$/);
my $id = 'pydio';
my $homedir = $pydio{'HomeDir'} || 'none';
$homedir = (($homedir eq 'enabled') || ($homedir eq 'users')) ? ':/home/e-smith/files/users':'';
$OUT .=<<_EOF;
[php$PHP_VERSION-$id]
user = www
group = www
listen.owner = root
listen.group = www
listen.mode = 0660
listen = /var/run/php-fpm/php$PHP_VERSION-$id.sock
pm = dynamic
pm.max_children = 15
pm.start_servers = 3
pm.min_spare_servers = 3
pm.max_spare_servers = 4
pm.max_requests = 1000
php_admin_value[session.save_path] = /var/lib/php/$id/session
php_admin_value[opcache.file_cache] = /var/lib/php/$id/opcache
php_admin_value[upload_tmp_dir] = /var/lib/php/$id/tmp
php_admin_value[error_log] = /var/log/php/$id/error.log
slowlog = /var/log/php/dl/slow.log
php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f php@{ $DomainName }
php_admin_flag[display_errors] = off
php_admin_flag[log_errors] = on
php_admin_value[error_log] = syslog
php_admin_value[memory_limit] = 128M
php_admin_value[max_execution_time] = 0
php_admin_value[post_max_size] = $max_upload_size
php_admin_value[upload_max_filesize] = $max_upload_size
php_admin_value[disable_functions] = system, show_source, symlink, exec, dl, shell_exec, passthru, phpinfo, escapeshellarg, escapeshellcmd
php_admin_value[open_basedir] = /usr/share/pydio:/var/lib/pydio:/var/log/pydio:/etc/pydio:/var/cache/pydio:/usr/share/pear/:/usr/share/php/:/home/e-smith/files/shares$homedir
php_admin_flag[allow_url_fopen] = off
php_admin_flag[file_upload] = on
php_admin_flag[session.cookie_httponly] = on
php_admin_flag[allow_url_include] = off
php_admin_value[session.save_handler] = files
php_admin_value[output_buffering] = off
_EOF
}
else{
$OUT .= '; Pydio is disabled';
}
}
}

@ -16,7 +16,7 @@ $data->{'core.ajaxplorer'}->{'AJXP_TMP_DIR'} ||= '/var/lib/pydio/tmp';
$data->{'core.ajaxplorer'}->{'DEFAULT_LANGUAGE'} ||= $pydio{'DefaultLanguage'} || 'en'; $data->{'core.ajaxplorer'}->{'DEFAULT_LANGUAGE'} ||= $pydio{'DefaultLanguage'} || 'en';
$data->{'core.ajaxplorer'}->{'APPLICATION_TITLE'} ||= $pydio{'Title'} || 'Pydio'; $data->{'core.ajaxplorer'}->{'APPLICATION_TITLE'} ||= $pydio{'Title'} || 'Pydio';
$data->{'core.ajaxplorer'}->{'CMDLINE_ACTIVE'} ||= '__true__'; $data->{'core.ajaxplorer'}->{'CMDLINE_ACTIVE'} ||= '__true__';
$data->{'core.ajaxplorer'}->{'CLI_PHP'} ||= '/usr/bin/php'; $data->{'core.ajaxplorer'}->{'CLI_PHP'} ||= '/usr/bin/php__PHP_VERSION__';
if (($pydio{'PublicShares'} || 'enabled') eq 'enabled'){ if (($pydio{'PublicShares'} || 'enabled') eq 'enabled'){
$data->{'core.ajaxplorer'}->{'PUBLIC_DOWNLOAD_FOLDER'} ||= '/var/lib/pydio/public'; $data->{'core.ajaxplorer'}->{'PUBLIC_DOWNLOAD_FOLDER'} ||= '/var/lib/pydio/public';

@ -2,8 +2,9 @@
# Name: Daniel Berteaud # Name: Daniel Berteaud
%define name smeserver-pydio %define name smeserver-pydio
%define version 0.2.11 %define version 0.3.0
%define release 1 %define release 0.beta1
%define phpversion 56
Summary: SME server integration of pydio Summary: SME server integration of pydio
Name: %{name} Name: %{name}
Version: %{version} Version: %{version}
@ -177,6 +178,9 @@ This contrib works with the smeserver-shared-folders addon
%build %build
perl ./createlinks perl ./createlinks
find root/ -type f | xargs grep -l __PHP_VERSION__ | xargs sed -i -e "s/__PHP_VERSION__/%{phpversion}/g"
%{__mkdir_p} root/var/log/php/pydio
%{__mkdir_p} root/var/lib/php/pydio/{tmp,opcache,session}
%install %install
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
@ -186,6 +190,11 @@ rm -f %{name}-%{version}-filelist
--file /etc/cron.daily/pydio-tmpwatch 'attr(0755,root,root)' \ --file /etc/cron.daily/pydio-tmpwatch 'attr(0755,root,root)' \
--file /etc/cron.daily/pydio-indexer 'attr(0700,root,root)' \ --file /etc/cron.daily/pydio-indexer 'attr(0700,root,root)' \
--file /usr/bin/pydiopdftotext 'attr(0755,root,root)' \ --file /usr/bin/pydiopdftotext 'attr(0755,root,root)' \
--dir /var/log/php/pydio 'attr(0770,root,www)' \
--dir /var/lib/php/pydio 'attr(0770,root,www)' \
--dir /var/lib/php/pydio/tmp 'attr(0770,root,www)' \
--dir /var/lib/php/pydio/opcache 'attr(0770,root,www)' \
--dir /var/lib/php/pydio/session 'attr(0770,root,www)' \
> %{name}-%{version}-filelist > %{name}-%{version}-filelist
%files -f %{name}-%{version}-filelist %files -f %{name}-%{version}-filelist

Loading…
Cancel
Save