Jump to content

Very unreliable development environment


tallinn

Recommended Posts

Hi.

I am starting to develop for PrestaShop and thus have set up an environment on my laptop to develop and test. The thing is that it is a very unreliable environment. Sometimes the shop loads, other times it redirects to the actual shop online, other times it just shows white empty website, and sometimes it redirects to the actual online shop after a few clicks in the development site localhost.

 

Currently I am getting a 500 error in mix with blank white site.

 

BTW: Just now as I am writing this post I noticed that I can not view the Advanced Parameters -> Configuration Information page. It just thinks for a while and then gives me a 500 error.

 

I am baffled as to what might be wrong. It is almost like the developer before me intentionally did a lot of stuff to create weirdness and left it like that for the next developer to rip his hair out.

 

Until now the admin console is behaving as it should. I can log in and see all the controls. I can change things and it does not redirect me or anything.

 

Is there any procedure I can do to make sure everything is as it should?

Regards

Link to comment
Share on other sites

Hi,

 

I would check the URLs in admin Preferences > SEO & URL if there are valid domains set.

 

Additionally check ps_shop_url table.

In ps_configuration table check value for `name` PS_SHOP_DOMAIN and  PS_SHOP_DOMAIN_SSL

 

If you are sure that you are in dev mode and getting white pages, you should check apache error logs.

If you don't have access to it, ask your hosting provider to send you this error.log.

 

Maybe it was hosting/server issue? You said everything goes well now, so it could be provider fault.

 

Good luck ;)

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

I would check the URLs in admin Preferences > SEO & URL if there are valid domains set.

 

That I have done. I have set them to the appropriate value pointing to my localhost folder within XAMPP.

 

 

Additionally check ps_shop_url table.

In ps_configuration table check value for `name` PS_SHOP_DOMAIN and  PS_SHOP_DOMAIN_SSL

 

I will double check when I get home today but I am pretty sure that this is what the Preferences -> SEO & URL changes. 

 

 

 

If you are sure that you are in dev mode and getting white pages, you should check apache error logs.

If you don't have access to it, ask your hosting provider to send you this error.log.

 

I am not sure that I am in dev mode. I did not know I had to be in dev mode to get results.  I mean, I thought that just getting the website running in a local environment would not be such a hassle. 

 

Maybe it was hosting/server issue?

 

I am trying to run the shop locally so I am the host :D

 

You said everything goes well now, so it could be provider fault.

 

I mentioned that the Admin console does not cause problems. When trying to view the shop as a customer then all hell breaks loose.

 

Thanks for the suggestions, I will check them out when I am home today. Any other suggestions are welcome. Maybe someone has done this before and can provide a step by step guide?

 

Cheers!

Link to comment
Share on other sites

I am not sure that I am in dev mode. I did not know I had to be in dev mode to get results.  I mean, I thought that just getting the website running in a local environment would not be such a hassle. 

 

So check the config/defines.inc.php

 

Find

define('_PS_MODE_DEV_', 

And check if there is true.

Link to comment
Share on other sites

Dev mode is needed when developing or when experiencing errors. Without Dev mode Prestashop will produce white screens and 500 errors and at best an error message in your server's error log. With Dev mode you will see the PHP error and its line number and you will know what is going wrong (or at least have a better guess).

 

Advanced Parameters -> Configuration Information page is a horrible page that even on fast systems sometimes causes a timeout. It says little about the stability of the rest of your system.

Link to comment
Share on other sites

I checked my SEO and URLs. In the ADMIN console they are set to:

Shop domain: localhost

SSL domain: localhost

Base URI: /projects/mystore/

 

And that is also what I see when I look in the database. Although I do not see the Base URI in the database.

 

 

After setting the dev mode to true I am getting some error messages that might lead to somewhere.

Here are some of them.

This is the first:

WARNING: INVALID ARGUMENT SUPPLIED FOR FOREACH() IN C:\XAMPP\HTDOCS\PROJECTS\MYSTORE\CLASSES\PRODUCT.PHP ON LINE 3437
Then a bunch of these:
NOTICE: UNDEFINED OFFSET: 197 IN C:\XAMPP\HTDOCS\PROJECTS\MYSTORE\OVERRIDE\CLASSES\CATEGORY.PHP ON LINE 79
 

 

Then some of the webpage layouts and pictures are displayed. It takes a lot of time for it to load. It is still like it is always redirected in a loop or something.

Sometimes this error pops up: 

The localhost page isn’t working

localhost redirected you too many times.

ERR_TOO_MANY_REDIRECTS
 
Sometimes I am actually redirected to the actual website where it is hosted with the hosting company.


More errors: 

Notice: Undefined variable: products_ids in C:\xampp\htdocs\projects\mystore\override\classes\Product.php on line 93

Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\projects\mystore\classes\db\DbPDO.php on line 91
 
 
This has to be some sort of error when importing the database or something right? Like half of the database got imported maybe.
Edited by tallinn (see edit history)
Link to comment
Share on other sites

The first thing I notice is that many of these problems happen under the Override directory. That means that some installed module is responsible.

 

Now you need to find out which module installed those files. You can do that by looking into those files (like \override\classes\Product.php) and see whether you can find some indication in their header. Alternatively you can experiment with disabling modules one by one and looking what happens.

Link to comment
Share on other sites

as user musicmaster already told: If you are using not native theme or not native modules, you should disable them, or at least find out which of them is writing errors and debug or disable them.

 

Other thing you should check is, if your XAMPP is proper configured to use Prestashop (php.ini)

 

  • magic_quotes_gpc = off
  • memory_limit = 256M (best: 512M - PS 1.6.)
  • max_execution_time = 300
  • max_input_time = 300
  • upload_max_filesize = 20M
  • post_max_size = 20M
  • max_input_vars = 10000
  • allow_url_fopen = on
  • safe_mode = off
  • cURL - installed/on for external payment services like Paypal
  • mod_rewrite = on
  • mod_security = off
  • php 5.4.5+.
  • mySQL 5.5+

redirections to actual shop means, that your .htaccess is not regenerated. Check the .htaccess on root of local ftp. Change manually new domain, check writing permissions (at least chmod 0755) and regenerate from BO as told on post#2.

After these changes clear cache of your local install (smarty and browser).

.

Link to comment
Share on other sites

What I have done now is to make sure that ps_shop_url reflects my setup.

domain: localhost

domain_ssl: localhost

physical_uri: /projects/mystore/

 

And from ps_configuration:

ps_shop_domain: localhost

ps_shop_domain_ssl: localhost

 

Now the problem is those error messages and the constant refreshing. The website never finishes loading. It just keeps doing something and the browser never reports the website finishing loading.

 

@selectshop.at  I made sure that these were set the way you suggest. I am not sure about three of them though: 

  • cURL - installed/on for external payment services like Paypal
  • mod_rewrite = on
  • mod_security = off

I did not find those.

 

@musicmaster  Okay. I have 110 modules installed, 16 disabled, and 56 modules to update. What steps do you suggest I take?

Now you need to find out which module installed those files. You can do that by looking into those files (like \override\classes\Product.php) and see whether you can find some indication in their header.

I am not sure how I would go about doing that. I do not know what I am looking for. In the product.php file there are just a bunch of methods like:

getAnchor($id_product_attribute)

getNewProducts($id_lang, $page_number = 0, $nb_products = 10, $count = false, $order_by = null, $order_way = null, Context $context = null)

getPricesDrop($id_lang, $page_number = 0, $nb_products = 10, $count = false, $order_by = null, $order_way = null, $beginning = false, $ending = false, Context $context = null)

getAttributesParams($id_product, $id_product_attribute)

getCopyColorAttributes($where, $id_lang, $page_number, $nb_products, $count, $order_by_prefix, $order_by, $order_way, $front, $context)

 

And that is about it.

 

 Alternatively you can experiment with disabling modules one by one and looking what happens.

I notice that they are categorized. Some are front end and some are backend. The backend modules are probably fine since the admin console works (for now) fairly well. Should I disable one after the other with a refresh of the website after each?

 

 

 

@electriz Here is the offending code around line 79. 

$setdatawithcolor = array();
        foreach ($result as $getproductgh){
            if($getproductgh['id_product_attribute'] > 0 &&$getproductgh['id_attribute_group'] == 8){
                if(!$setdatawithcolor[$getproductgh['id_product']][$getproductgh['id_attribute']]){
                    $setdatawithcolor[$getproductgh['id_product']][$getproductgh['id_attribute']] = $getproductgh['id_product_attribute'];
                }
            }else{
                $setdatawithcolor[$getproductgh['id_product']][0] = NULL;
            }
        } 

Line 79 is now the offender, not 93 as previously. And it is from the Category.php not Prodcut.php. 


I also regenerated my .htaccess file by turning friendly url off and saving, then turning it back on and saving. In the SEO and URLs from the backoffice.

Link to comment
Share on other sites

I have tried to disable ALL of the modules in the Advanced parameters -> Performance tab in the back office. 
This stops the errors from being shown but the page still refreshes infinitely. So maybe it is best to figure that one out first with all the modules disabled.  
There must be some setting that I am overseeing...

Link to comment
Share on other sites

Have you also tried to turned off overrides?

 

Ops. Sorry.

That is the option I tried.

 

So in my previous post: "I have tried to disable ALL of the modules in the Advanced parameters -> Performance tab in the back office. " Was supposed to be: I have tried to disable ALL of the overrides in the Advanced parameters -> Performance tab in the back office.

 

That had the effect described in my previous post.

 

Sorry for the imprecise description.

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

You also switched to native theme ? It could be that if you disable all foreign modules and overrides has the "refresh" effect, if some override code is added directly to them files, instead of correct way, as a override on /override folder.

 

mod_security and mod_rewrite are php instances. You activated also a phpinfo for to check if these modules are installed ?

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...