Prestashop: apache PHP-FPM Unable to open primary script BO /index.php/URL

Created on 11 Dec 2018  ·  15Comments  ·  Source: PrestaShop/PrestaShop

I've search many times but i've not found any information , so i think this is a problem in how PS BO handle url, and maybe there is someone that can fix this on PS:

[proxy_fcgi:error] [client 127.0.0.1:44230] store.sixrace.it AH01071: Got error 'Unable to open primary script: redirect:/index.php/catalog (No such file or directory)\n'

Problem is that /index.php/* was not right interpreted from php-fpm, any one know a solution? its a bug?

Additionnal information
PrestaShop version: 1.7.2
PHP version: pgp-fpm 7.0

1.7.2.4 No change required

Most helpful comment

This is how I fixed issues on Apache + php-fpm:

Edit php.ini and set
cgi.fix_pathinfo=1

Edit pool.d/www.conf and set
security.limit_extensions =

Notice that I set limit_extesions to blank, thus allowing all extensions, otherwise a path like "index.php/catalog" will throw an "Access denied" exception. BO uses different url's like that one, without a .php extension and without using mod_rewrite rules in .htaccess (I don't know why).

Notice: I use php-fpm for my dev environment so security is not an issue. Allowing all extensions (security.limit_extensions) on a prod env is not recommended.

All 15 comments

HI @matteolavaggi,

Thanks for your report.
In your server configuration, it could be that PHP-environment has a "changed root".
Could you please check on your server if the fastcgi parameter SCRIPT_FILENAME with a leading $document_root.
If yes, thanks to check your with this fix
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;

Update: i'm unable to make it working under apache php-fpm.

So after many workaround i've decide to apply a mixed configuration:

FO > NGINX PROXY > APACHE > PHP-FPM
BO > NGINX > PHP-FPM

on BO there is no rewrite url requirements so we can use NGINX without problme, hoping in the next release will be finally a support for NGINX out of the box.

There is any right section to share the NGINX + CACHE + PROXY + APACHE + PHP-FPM configuration for any one in the same trouble?

Hi @matteolavaggi ,
For your information, we can't provide a Nginx support out of the box, because Nginx does not support .htaccess or anything similar. This is why we provide an example of configuration here:
https://github.com/PrestaShop/PrestaShop/blob/develop/docs/docker/nginx_fpm/prestashop-nginx/prestashop-nginx.conf :)

Having an Nginx proxy to serve and apache + fpm is maybe not a good idea when you can directly plug fpm to the Nginx service.

Regards

Hi dear, prestashop doesn't work out of the box with nginx, also with the file example provided. Too many problems on rewrite, module page, backned and image. For this reason we need to use apache like back end . Also caching system of ps is something horrible and usefull - less in 2018 ...

@matteolavaggi, with Nginx you can't use htaccess files in Nginx context, you need to write your own rules.
this file is generated by prestashop but it's because Apache allows to use it. Unlike Nginx.
You can find example here: https://github.com/PrestaShop/PrestaShop/blob/develop/docs/server_config/nginx.conf.dist
Thanks!

Hi dear, i know how work nginx and what is an .htaccess. what I can not understand is the assence of a supported and mainteined configuration file for nginx by prestashop developers. In 2018 is one of the worst supported ecommerce platform on nginx ... ^^

ping @PierreRambaud what do you think?
Thanks!

As I said previously, Nginx does not work like Apache and does not understand .htaccess files (which store the configuration containing rewrite rules).
So we are not able to store the exact configuration needed for your server because you need to create a specific virtual host with your information
If you do not know what is Nginx and how it works, you need to call a professional, this is exactly what you do (I think) when you want to repair your house or your car when it becomes too complicated.
For your information, even wordpress, drupal, and joomla does not provide a file in the source to automatically configure Nginx :wink:

Dear developer can create the file, customer can include in the vhosts config. ;)

Hi @matteolavaggi,

Since we had no news from you for more than 30 days, I'll close this ticket. Feel free to open another one if you can give specific details.
Thanks!

This is how I fixed issues on Apache + php-fpm:

Edit php.ini and set
cgi.fix_pathinfo=1

Edit pool.d/www.conf and set
security.limit_extensions =

Notice that I set limit_extesions to blank, thus allowing all extensions, otherwise a path like "index.php/catalog" will throw an "Access denied" exception. BO uses different url's like that one, without a .php extension and without using mod_rewrite rules in .htaccess (I don't know why).

Notice: I use php-fpm for my dev environment so security is not an issue. Allowing all extensions (security.limit_extensions) on a prod env is not recommended.

Thanks for the info with cgi.fix_pathinfo. What's the suggested way of using php-fpm from prestashop side with having security.limit_extensions = .php as it should be for productive environments?

Cheers
Andi

the problem is not in the security limit extension. Is in the script you
pass on php-fpm in configuration.

Il giorno gio 23 mag 2019 alle ore 16:31 Andi Nitsche <
[email protected]> ha scritto:

Thanks for the info with cgi.fix_pathinfo. What's the suggested way of
using php-fpm from prestashop side with having security.limit_extensions =
.php as it should be for productive environments?

Cheers
Andi


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/PrestaShop/PrestaShop/issues/11721?email_source=notifications&email_token=AF5GL35CCVFOVB6DGEETW2TPW2TE5A5CNFSM4GJVTGMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWCNEYY#issuecomment-495243875,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AF5GL366UCSADQ7PB5DV2ETPW2TE5ANCNFSM4GJVTGMA
.

--
cordialmente,
FATTURAZIONE ELETTRONICA B2B
Il nostro codice destinatario (alcuni lo chiamano “codice SDI”) è il
seguente: M5UXCR1

Matteo Lavaggi
CEO

ufficio +390245071999

www.pineappleitaly.com/pineapplegroup

PINEAPPLE® S.r.l.
Capitale sociale €100.000 i.v.
SL: Galleria C.so Garibaldi 16-18, 16043 Chiavari (GE) Italy
P.I./C.F.(VAT REG): IT01953500996 REA 447687 CCIAA di GENOVA

Full contacts: www.pineappleitaly.com/contatti

The information contained in this message is intended only for use of the
individual(s) named above and may contain confidential, proprietary or
legally privileged information. No confidentiality or privilege is waived
or lost by any mistransmission. If you are not the intended recipient of
this message you are hereby notified that you must not use, disseminate,
copy it in any form or take any action in reliance of it. If you have
received this message in error please delete it and any copies of it and
notify the sender immediately.

location /admin_ {
try_files $uri $uri/ @admin_;

            add_header Cache-Control "no-cache, max-age=1";

            location ~ \.php$ {
            fastcgi_pass   unix:/run/php/php7.0-fpm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME

$document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 10000;
#proxy_pass http://127.0.0.1:8080;
}
}

    location @admin {
            rewrite /admin_/(.*)$ /admin_/index.php?/$1 last;
    }

example for BO under nginx + fpm

Il giorno gio 23 mag 2019 alle ore 16:31 Andi Nitsche <
[email protected]> ha scritto:

Thanks for the info with cgi.fix_pathinfo. What's the suggested way of
using php-fpm from prestashop side with having security.limit_extensions =
.php as it should be for productive environments?

Cheers
Andi


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/PrestaShop/PrestaShop/issues/11721?email_source=notifications&email_token=AF5GL35CCVFOVB6DGEETW2TPW2TE5A5CNFSM4GJVTGMKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODWCNEYY#issuecomment-495243875,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AF5GL366UCSADQ7PB5DV2ETPW2TE5ANCNFSM4GJVTGMA
.

--
cordialmente,
FATTURAZIONE ELETTRONICA B2B
Il nostro codice destinatario (alcuni lo chiamano “codice SDI”) è il
seguente: M5UXCR1

Matteo Lavaggi
CEO

ufficio +390245071999

www.pineappleitaly.com/pineapplegroup

PINEAPPLE® S.r.l.
Capitale sociale €100.000 i.v.
SL: Galleria C.so Garibaldi 16-18, 16043 Chiavari (GE) Italy
P.I./C.F.(VAT REG): IT01953500996 REA 447687 CCIAA di GENOVA

Full contacts: www.pineappleitaly.com/contatti

The information contained in this message is intended only for use of the
individual(s) named above and may contain confidential, proprietary or
legally privileged information. No confidentiality or privilege is waived
or lost by any mistransmission. If you are not the intended recipient of
this message you are hereby notified that you must not use, disseminate,
copy it in any form or take any action in reliance of it. If you have
received this message in error please delete it and any copies of it and
notify the sender immediately.

This is how I fixed issues on Apache + php-fpm:

Edit php.ini and set
cgi.fix_pathinfo=1

Edit pool.d/www.conf and set
security.limit_extensions =

Notice that I set limit_extesions to blank, thus allowing all extensions, otherwise a path like "index.php/catalog" will throw an "Access denied" exception. BO uses different url's like that one, without a .php extension and without using mod_rewrite rules in .htaccess (I don't know why).

Notice: I use php-fpm for my dev environment so security is not an issue. Allowing all extensions (security.limit_extensions) on a prod env is not recommended.

This is working. Thank you so much...

Was this page helpful?
0 / 5 - 0 ratings