Git Product home page Git Product logo

Comments (16)

colinmollenhour avatar colinmollenhour commented on July 18, 2024 1

Ehh, what a mess. Here is a possible hack:

<IfModule mod_php5.c>
// Set doPhp = 1
</IfModule>
<IfModule mod_php7.c>
// Set doPhp = 1
</IfModule>
<If doPhp>
// php flags here
</If>

I don't know the exact syntax to use offhand though, perhaps SetEnv.

from magento-lts.

 avatar commented on July 18, 2024 1

Yup. I came across this earlier, although it's only supported with apache 2.4. Can we drop support for older versions of apache?

<IfModule mod_php5.c>
    Define PHP_IS_ENABLED
</IfModule>

<IfModule mod_php7.c>
    Define PHP_IS_ENABLED
</IfModule>

<IfDefine PHP_IS_ENABLED>
</IfDefine>

Otherwise I'm just inclined to add a comment to the htaccess noting about PHP7, but I did have a few hours of wondering why my PHP's max memory wasn't being read before I realized the php5 bit. Fixing this would definitely help out people down the line.

from magento-lts.

colinmollenhour avatar colinmollenhour commented on July 18, 2024

I would prefer to just remove <IfModule mod_php5.c> instead of duplicate. If PHP isn't present then you've got major problems and probably don't want your webserver starting anyway and AFAIK all mod_php5 directives are compatible with all mod_php7 directives.

from magento-lts.

 avatar commented on July 18, 2024

Removing the <IfModule mod_php5.c> may cause issues with apache+fastcgi. I don't use fastcgi myself so I can't say for certain, but from what I've read using php_value in .htaccess without mod_php causes a 500 error. See http://stackoverflow.com/questions/4117572/using-htaccess-with-fastcgi#4118492

from magento-lts.

seansan avatar seansan commented on July 18, 2024

@jtnw Any thoughts on this? Or has this been solved?

from magento-lts.

 avatar commented on July 18, 2024

@seansan for me, I just changed php5 to php7 in htaccess, haven’t touched it in the past year.

Apache 2.4 came out in 2012, so the Define directive should be widely supported. I would recommend we use the structure in my previous comment.

from magento-lts.

seansan avatar seansan commented on July 18, 2024

from magento-lts.

 avatar commented on July 18, 2024

Sure thing, let me just do a quick test to make sure that the directive works.

from magento-lts.

Flyingmana avatar Flyingmana commented on July 18, 2024

actually, Apache is kind of recommending to stop using mod_php https://wiki.apache.org/httpd/php and instead use the fcgi solutions.

Besides, everybody should get used to set php settings via the php.ini

from magento-lts.

 avatar commented on July 18, 2024

Also, it seems that the Define directive cannot be used in .htaccess. I am trying this solution as well, but it doesn't seem to work for me: https://stackoverflow.com/a/49031283

Edit: so basically it means the Define solution would mean the user would have to edit the httpd.conf file to set the define which is much more confusing for a user.

from magento-lts.

 avatar commented on July 18, 2024

I think the only solution right now is to duplicate the directives and put a comment in htaccess explaining it. Seems like mod_php shouldn't be used, but many people will keep using it and those htaccess settings for php are important. If there's another way I'm all ears though.

from magento-lts.

Flyingmana avatar Flyingmana commented on July 18, 2024

with mod_php you can use a php.ini like with php-fpm and php-cli
Every non-apache user is already doing this, and you need to put most of this settings anyway also for cli.

regarding the settings.

setting .htaccess php default comment
memory_limit 256M 128M is actually set higher in most environments I know
max_execution_time 18000 30 thats 5hours!!!, for cli it should be unlimited, for webserver this is cazy high
magic_quotes_gpc off off
session.auto_start off off
suhosin.session.cryptua off off
zend.ze1_compatibility_mode off off

from magento-lts.

 avatar commented on July 18, 2024

@Flyingmana does the custom php.ini file require editing vhosts/httpd.conf though? Some users won't be able to edit those files if they're on shared hosting of any sort.

from magento-lts.

Flyingmana avatar Flyingmana commented on July 18, 2024

@jtnw I would refer to the documentation/faq/support of the shared hosting then. Also shared hostings likely would not allow to change memory_limit or max_execution_time in any way.

If people notice specific problems with the Environment, they would need to know where to change this settings anyway. And for people not used to apache, it could be confusing to change a setting, and wonder why it is overwritten somewhere else.

from magento-lts.

 avatar commented on July 18, 2024

@Flyingmana good points, my only other reservation on making users edit httpd.conf is that it's a departure from the upstream installation process where users just have to extract to htdocs. However if there's a much better solution than my PR above which was just a quick fix, we should take it.

from magento-lts.

colinmollenhour avatar colinmollenhour commented on July 18, 2024

Closed by #1001

from magento-lts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.