Jump to content

PrestaShop shows white page except if index.php is opened directly


FreshFlow

Recommended Posts

Hi all,

we have moved a PrestaShop installation (I guess its version 1.6.x) from another server to a new one.

On the new server, the shop only shows a blank page, unless you open the index.php file directly. So, opening http://www.example.com  does not work and shows a blank page, but opening http://www.example.com/index.php shows the shop as expected. Opening the admin area does not work at all and always shows a blank page (neither http://www.example.com/adminEXAMPLE nor http://www.example.com/adminEXAMPLE/index.php work).

In config/defines.inc.php I have set the constant _PS_MODE_DEV_ to true, so errors should show up, but the page is just blank. If there are errors, they are hidden for some reason.

I thought it may be because of an error in the .htaccess, but changing things didn't work. I will poste the current contents of the .htaccess file anyway:

# ~~start~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again
# .htaccess automaticaly generated by PrestaShop e-commerce open-source solution
# http://www.prestashop.com - http://www.prestashop.com/forums

<IfModule mod_rewrite.c>
    <IfModule mod_env.c>
        SetEnv HTTP_MOD_REWRITE On
    </IfModule>

    RewriteEngine on

    RewriteRule . - [E=REWRITEBASE:/]
    RewriteRule ^api$ api/ [L]

    RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]

    # AlphaImageLoader for IE and fancybox
    RewriteRule ^images_ie/?([^/]+).(jpe?g|png|gif)$ js/jquery/plugins/fancybox/images/$1.$2 [L]
</IfModule>

AddType application/vnd.ms-fontobject .eot
AddType font/ttf .ttf
AddType font/otf .otf
AddType application/x-font-woff .woff
<IfModule mod_headers.c>
	<FilesMatch ".(ttf|ttc|otf|eot|woff|svg)$">
		Header add Access-Control-Allow-Origin "*"
	</FilesMatch>
</IfModule>

#If rewrite mod isn't enabled
ErrorDocument 404 /index.php?controller=404

# ~~end~~ Do not remove this comment, Prestashop will keep automatically the code outside this comment when .htaccess will be generated again

Any idea what could be causing this problem?

Link to comment
Share on other sites

Can you access the backoffice?

If so, try to regenerate the htaccess file from there.

You should check the PHP version of the new server, and make sure it is compatible with your version of PrestaShop.

You can also look for an error_log file in the root directory of PrestaShop, and see if it exists and has more insight.

Link to comment
Share on other sites

1 minute ago, tomerg3 said:

Can you access the backoffice?

If so, try to regenerate the htaccess file from there.

You should check the PHP version of the new server, and make sure it is compatible with your version of PrestaShop.

You can also look for an error_log file in the root directory of PrestaShop, and see if it exists and has more insight.

Thanks for your reply. No, as I said in my initial question, I can't open the backoffice (what I called the admin area). It always shows a blank screen.

Link to comment
Share on other sites

Just now, FreshFlow said:

Thanks for your reply. No, as I said in my initial question, I can't open the backoffice (what I called the admin area). It always shows a blank screen.

You should check the PHP version of the new server, and make sure it is compatible with your version of PrestaShop.

You can also look for an error_log file in the root directory of PrestaShop, and see if it exists and has more insight.

Link to comment
Share on other sites

I just made a very curious observation: apparently I have accidentally added a whitespace to the index.php right before the opening <?php, so that this whitespace is actually printed to the page. I thought that was an error because obviously redirects wont work like that anymore, so I removed that whitespace again. However, if I remove that whitespace, the page doesn't show anymore, it is always blank. Only when I add that whitespace, the page is displayed when I open the index.php file in the browser directly.

I am really confused what could be causing this weird behavior.

Edited by FreshFlow (see edit history)
Link to comment
Share on other sites

Stupid solution to the problem: I had to step through it with a debugger to realize that the PHP version was not supported by the installed version of PrestaShop (PHP7.3 and PrestaShop 1.6.1.11). The page only showed up when I added a white space because in that case, Presta didn't try to set cookies (because output had already been sent) and therefore didn't try to use mcrypt to encrypt them. The mcrypt extension is not part of PHP anymore and therefore execution died, for some reason without showing errors. Upgrading to the latest version of 1.6 solved the issue... I wish it had shown that error.

Link to comment
Share on other sites

1 hour ago, FreshFlow said:

Stupid solution to the problem: I had to step through it with a debugger to realize that the PHP version was not supported by the installed version of PrestaShop (PHP7.3 and PrestaShop 1.6.1.11). The page only showed up when I added a white space because in that case, Presta didn't try to set cookies (because output had already been sent) and therefore didn't try to use mcrypt to encrypt them. The mcrypt extension is not part of PHP anymore and therefore execution died, for some reason without showing errors. Upgrading to the latest version of 1.6 solved the issue... I wish it had shown that error.

I suggested twice to check the php version, I'm glad you found that out. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...