Concrete5 v 8.2.1 PHP Versions

Permalink
Morning.
Im still new in this and testing different PHP versions for Concrete5 (v8.2.1)

Everything work ok in PHP 5.6.31
session.save_path /var/lib/php/session (Default)
open_basedir {WEBSPACEROOT}{/}{:}{TMP}{/}


In PHP 7.0.21 and 7.1.7
session.save_path /var/lib/php/session (Default)
open_basedir {WEBSPACEROOT}{/}{:}{TMP}{/}

I get this error message

[code]
is_dir(): open_basedir restriction in effect. File(/var/lib/php/session) is not within the allowed path(s): (/var/www/vhosts/mysite.com/:/tmp/)
[/code

No problem for me, I set it to PHP 5.6.31, but I don't understand why I get the error message.

session.save_path and open_basedir is same for all PHP versions

Regards
Helge

 
italinux replied on at Permalink Reply
italinux
Hello Helge

How's it going?
Have you found the solution for this .. because I am facing the exact same issue.

If yes, how have you solved it?

Regards
Matteo
jasteele12 replied on at Permalink Reply
jasteele12
Safe to say the php.ini settings are not the same between the different PHP versions.

The PHP 7 error message tells exactly what's happening - /var/lib/php/session in not within the open_basedir restriictions of /var/www/vhosts/mysite.com/ nor /tmp/

In most cases you are best off using your own temporary directory, especially on shared hosting. Besides not being slowed down by too many files in one directory, you can manually delete anything you want (similar to clearing the c5 cache).

Put this in application/config/concrete.php (or add to the array if it is already there):

<?php // application/config/concrete.php - overrides concrete/config/concrete.php
return array(
  'filesystem' => array(  // application/files/cache/tmp
    'temp_directory' => DIR_FILES_UPLOADED_STANDARD. '/cache/tmp'),
  'session' => array(     // concrete.session.save_path
    'save_path' => DIR_FILES_UPLOADED_STANDARD. '/cache/tmp',
    'cookie' => array('cookie_path' => DIR_FILES_UPLOADED_STANDARD. '/cache/tmp'))
);
Hope that helps, John
italinux replied on at Permalink Reply
italinux
Hello John

Apparently it does NOT.
I have followed your instructions:

Look at the error message I get here: http://italinux.com

That happens from version >= 8.2.0
Any other clue?
italinux replied on at Permalink Reply
italinux
Actually this is my version of php there:
http://italinux.com/info.php
jasteele12 replied on at Permalink Reply
jasteele12
Hi Matteo,

Not sure what NOT you are referring to, but you are running 5.6.30 (not 7.x) and your php.ini has the session.save_path set to:

/home/italinux.com/tmp/

The code I posted would set this to:

/home/italinux.com/application/files/cache/tmp/

Try creating /home/italinux.com/tmp/ and make sure it is writeable.

If that doesn't work, add the code above to application/config/concrete.php and deleting everything under application/files/cache/ and removing application/config/generated_overrides/

It appears your default open_basedir is not set, but your php.ini is set to /home/italinux.com/ - you could try removing that setting and restarting PHP...
jasteele12 replied on at Permalink Reply
jasteele12
Looks like you could also check /home/italinux.com/.user.ini (if it exists).
italinux replied on at Permalink Reply
italinux
Hi John

File /home/italinux.com/.user.ini is NOT there at present time

Matteo
italinux replied on at Permalink Reply
italinux
Added this entry to /home/italinux.com/.user.ini

[PHP]
; open_basedir, if set, limits all file operations to the defined directory
; and below.  This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file.
; http://php.net/open-basedir
open_basedir = /home/italinux.com/tmp

NB: /home/italinux.com/tmp is writable (is has always been)
NO LUCK, still same error: http://itainux.com
italinux replied on at Permalink Reply
italinux
Hello John

I've followed your instruction again step by step.

The result is the same: http://italinux.com

The only think I couldn't do is to modify my php.ini and that's because I am on a Hosting managed shared environment. So I cannot do that.

I can play with the .htaccess however,I guess that wouldn't be enough so solve this issue.

NB: I must point out .. with version =< 8.1.0 everything works fine

Don't know what to do at this point ..
jasteele12 replied on at Permalink Reply
jasteele12
If you can, modify your .user.ini to set open_basedir to /home/italinux.com/ (no tmp/ at the end).

Like the error says, /tmp is not under /home/italinux.com/

You may need to either kill any running PHP instances (or restart Apache) or possibly wait awhile and try again.

According to your first /info.php the basedir is not set by default (meaning probably /tmp) but your copy of PHP is - so it's being overridden somewhere (control panel)?

Do you have shell access?
italinux replied on at Permalink Reply
italinux
Hi

I've now edited the .user.ini accordingly and I cannot restart apache in any way,
that will happen automatically at some point.

But anyway, to me, open_basedir already has a value and it's correct there.
phpinfo says within the column "local value" is already "/home/italinux.com/"

So to be honest I do not think having defined open_basedir within .user.ini will change anything
italinux replied on at Permalink Reply
italinux
[you say]
According to your first /info.php the basedir is not set by default (meaning probably /tmp) but your copy of PHP is - so it's being overridden somewhere (control panel)?

Do you have shell access?

[I say]
According to http://italinux.com/info.php (php.ini) the basedir is set to /home/italinux.com/
My control panel does not have any power over php.ini

I do not have shell access no
jasteele12 replied on at Permalink Reply
jasteele12
So since it used to be set to /home/italinux.com/tmp and now it's /home/italinux.com/ it appears the .user.ini change did work.

Maybe check your .htaccess (or try adding this):
[code]
php_value open_basedir "/home/italinux:/tmp"
[code]Since

Do you have any addons that might be using /tmp ?

How did you manage to install 8.2.1?
italinux replied on at Permalink Reply
italinux
Hi John

I might be wrong but to me .. we've always got this exact same error message:
realpath(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/home/italinux.com/)

It's not the .user.ini that changes anything and as I've just tried it's not even the .htaccess I am sorry to say.
php_value open_basedir "/home/italinux.com/tmp"

As far as I can think of .. there are currently NO add-ons there using realpath() or trying to write in /tmp. I am pretty confident about that because I built them all.
However I could enable the default theme .. but it's not that I mean this is a php configuration issue anyway.

How I installed v8.2.1?
Well first of all it's not v8.2.1 but v8.2.0 installed there and I did it via c5 web interface and via bash script / FTP too, exact same result. And by the way .. exact same result with v8.2.1 where with version <= v8.1.0 it has always worked like a charm.

Like this one: http://resume.italinux.com
jasteele12 replied on at Permalink Reply
jasteele12
The error message you used to get was about /home/italinux.com/tmp and now it's /home/italinux.com - so it definitely changed.

The .htaccess I suggested is not what you put there - it's not /home/italinux.com/tmp it's /home/italinux[colon]/tmp

There has definitely been some directory related stuff that changed in 8.2.1 - symlinks to concrete don't work the way they used to - they have to symlink to a directory *named* concrete, which is very strange in my opinion - not sure why that was changed either...
italinux replied on at Permalink Reply
italinux
So you basically suggest to do this:
php_value open_basedir "/home/italinux.com:/tmp"

But it doesn't make sense to me because in a shared environment and of course it doesn't work.
We get the exact same error message
jasteele12 replied on at Permalink Reply
jasteele12
It is very common for shared user accounts to have access to /tmp or /var/tmp.

If you got the *exact* same error message (it doesn't contain :/tmp) then it's hasn't taken effect yet.

Might be time to ask your hosting provider about it (and maybe caching)...
italinux replied on at Permalink Reply
italinux
John

Look this is my concrete.php placed in /application/config/
<?php
return array(
    'filesystem' => array(
        'temp_directory' => DIR_FILES_UPLOADED_STANDARD . '/cache',
    ),
    'session' => array(
        'handler' => 'database',
        'save_path' => DIR_FILES_UPLOADED_STANDARD . '/cache',
        'cookie' => array(
            'cookie_path' => DIR_FILES_UPLOADED_STANDARD . '/cache',
        ),
    ),
    'external' => array(
        'intelligent_search_help' => true,
        'news_overlay' => false,


And this is my .htaccess placed in /home/italinux.com/public_html/
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
# Redirect www to NO-www
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# Pretty URL (no index.php)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}/index.html !-f
RewriteCond %{REQUEST_FILENAME}/index.php !-f
RewriteRule . index.php [L]
</IfModule>
php_value open_basedir "/home/italinux.com:/tmp"


And this is my .user.ini placed in /home/italinux.com/
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini   ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
; open_basedir, if set, limits all file operations to the defined directory
; and below.  This directive makes most sense if used in a per-directory
; or per-virtualhost web server configuration file.
; http://php.net/open-basedir
open_basedir = /home/italinux.com/


So what's the next step you where suggesting?
jasteele12 replied on at Permalink Reply
jasteele12
Try removing the last , [comma] from the returned array in application/config/concrete.php

Your .user.ini should read (it appears it is overriding your .htaccess):
open_basedir = "/home/italinux.com:/tmp"
# might try this
session.save_path = "/home/italinux.com/tmp"

.user.ini changes will be cached for 5 minutes according to your phpinfo
jasteele12 replied on at Permalink Reply
jasteele12
Also, the session save path will have no effect if the hanlder is set to database...
italinux replied on at Permalink Reply
italinux
Korvin today told me he has been working recently on the core cache system and he gave me this link asking my opinion if I think this could be the reason: https://github.com/tedious/Stash/pull/351...
jasteele12 replied on at Permalink Reply
jasteele12
Don't think it's that, since your PHP build has '--disable-opcache'

The only thing in your PHP config that references /tmp is:

soap.wsdl_cache_dir - but I doubt that is the problem.

I see no difference referencing /tmp between the 8.1.0 and 8.2.1 core code...
italinux replied on at Permalink Reply
italinux
John

Just to clear the doubt about add-ons and themes
I've managed to enable the default theme "elemental" and with concrete5 v8.2.0

This is the result: http://italinux.com
We get the exact same error message .. so it's not a package (add-on or theme) issue
jasteele12 replied on at Permalink Reply
jasteele12
There have been some file handling changes in 8.2.1 since 8.1.0, such as symlinks of the concrete directory now have to be *named* concrete - which I think is a bug.

Ex: ln -s ../821 concrete (used to work) : ln -s ../820 concrete still does
Now needs to be: ln -s ../821/concrete concrete

What happens if you try to install a fresh 8.2.1 into a test subdomain?
italinux replied on at Permalink Reply
italinux
I'll install it there in 5 minutes if you like.
jasteele12 replied on at Permalink Reply
jasteele12
You might also need to put the .user.ini in the subdomain directory.

It might need to be in /home/italinux.com/public_html/.user.ini for your main domain - depends on the hosting company setup.

Something is referencing /tmp - sure would help if the error message showed a file/line #.

Wonder if you have something in your Config database table...
italinux replied on at Permalink Reply
italinux
I am not doing it in a subdomain,
I'll do it right there in the same domain .. alright?
italinux replied on at Permalink Reply
italinux
I've been looking for error messages again within logs folder /home/italinux.com/logs
There are error.log files along with access.logs but there are absolute NO error messages which could help us
italinux replied on at Permalink Reply
italinux
John

Installed Concrete5 version 8.2.1 into /home/italinux.com/public_html
Domain: http://italinux.com

Exact same error message :
realpath(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/home/italinux.com/)
jasteele12 replied on at Permalink Reply
jasteele12
So if this is a fresh install, then there is nothing in your public_html/packages/ directory right?

It appears PHP 7.0 is available, could try switching to that, but I'm running out of ideas :(
italinux replied on at Permalink Reply
italinux
John

This is a good idea, Debugging Environment look: http://italinux.com
italinux replied on at Permalink Reply
italinux
The version installed there is v8.2.0 even though at some point it says v8.1.0 that's because there's no record in update.php within /application/config alright?

So it's just a cosmetic thing alright.

You have there a full concrete5 v8.2.0

Does that help a bit?
jasteele12 replied on at Permalink Reply
jasteele12
Something about that sounds fishy.

info.php still says basedir is /home/italinux.com/ not /home/italinux.com:/tmp

Not sure why you wouldn't use 8.2.1 and PHP 7.0 - if you don't want a subdomain, how about installing it into a fresh subdirectory. and fresh database.

FYI - There is no file change to FileLocator.php between 8.1.0 and 8.2.1

There really should be no problem with that setup under Gentoo Linux - *something* is referencing /tmp
italinux replied on at Permalink Reply
italinux
Hi John

Fresh installation, solved the problem.
Still running php v5.6.3.0 and I've installed concrete5 v8.2.0

Works well now .. I guess the problem had to do with c5 dealing with upgrading versions, obviously at this point

Alright, http://italinux.com

Thanks mate
jasteele12 replied on at Permalink Reply
jasteele12
Glad to hear it!

I'd still go with PHP7 (much faster) and 8.2.1 ;)
italinux replied on at Permalink Reply
italinux
John

You know what the problem was or still is:
Manually upgrading concrete5 core.

I did follow the instructions on this link:
https://documentation.concrete5.org/developers/installation/upgradin...

-> Chapter: "Replacing the original concrete Directory (Version 8 and above)"
-> Which basically says: "just replace the concrete directory with the new one"

And that throws all those errors.
The way I do it is totally automatic via command line .. meaning my bash script upload the new core remotely via FTP and then it queries a php file which unzip the package and replace the old one. Pretty smart ah?

Doesn't throw any error however it doesn't work as it results on that open_basedir thing.

I really think concrete5 version are hard to upgrade from a version to another .. I actually remember I did try manually via the c5 site web interface and it results the exact same error.

I love the idea of upgrading with my script via command line though I am disappointed it doesn't work. I don't want to reinstall eveything eachtime I want to upgrade the core .. I mean I lose the whole configuration is too bad.

Don't you think?
jasteele12 replied on at Permalink Reply
jasteele12
After turning off all caching, a database backup & replacing the concrete core directory (I do this with symlinks) you have to immediately go to:

http://italinux.com//index.php/ccm/system/upgrade...

I've never ran into your problem, but I never use a hosting provider that doesn't provide SSH access ;) Check out SiteGround's (UK) Grow BIg plan (massive discount right now on 3 years):

http://steelesoft.net/siteground... (I'm a very satisfied customer and an affiliate)

concrete5 runs like a racehorse on their SSD drives, SuperCacher and great support.

I still don't understand why you wouldn't go with PHP7 and c5 8.2.1 since you are starting from scratch - why install 8.2.0 and then fail/try to upgrade?

Also, before, you told my you didn't have shell access. How are you running a bash script from the command line then???
italinux replied on at Permalink Reply
italinux
Hi John

Yes that's right, that's the right procedure to upgrade concrete5 core.

About hosting, OK I thank you for suggesting a good hosing.
I'll definitely take a look at that company even though I am generally happy with my current one.

Reason why I am not changing hosting just now is because I am actually towards the end of development of a few c5 themes which soon will be published onto the marketplace and this thing goes on top priority now.

I've the demos online already though

1. http://personal-pro.italinux.com...
2. http://resume.italinux.com
3. http://resume-pro.italinux.com
plus other 2 ..

So that goes first .. and generally speaking I actually upgrade the core versions just only when on the new core versions there are functionalities which are required or improve considerably the performances.

So it's not that much important to me now switching from 8.2.0 to 8.2.1 now .. maybe when the themes will be published yes I'll give even more importance to the core versions .. but for now themes completion go first.

Thanks a lot man, much appreciate this conversation with you and your support

Cheers
Matteo
italinux replied on at Permalink Reply
italinux
But hey John

Just checking with you about this matter
Do you find this website (my site) being slow?

http://matteo-montanari.com

CIao
Matteo
jasteele12 replied on at Permalink Reply
jasteele12
Hi Matteo,

You are very welcome and I'm glad you got things working.

I would think that you would want to make sure your themes were 8.2.1 compatible, might as well at least test them.

As far as your site speed, it's not very good - see these 2 tests. The first is from my state of Oregon (I'm across the pond ;)

http://www.webpagetest.org/result/171003_FS_184ff3bed5a3923bd8940ec...

The second is from London:

http://www.webpagetest.org/result/171003_D0_026da24b4a65a3dbd3993cf...

The TTFB (Time To First Byte) is absolutely horrible - anything approaching .500ms (1/2 a second) is really bad. Nothing you can do about that other than switching to a faster hosting provider.

Your Start Render time is also not impressive, so of course your total Load Time is quite bad. Google is not impressed (but has some tools to help). See the "Optimizations Found" at the bottom of these results:

https://developers.google.com/speed/pagespeed/insights/?url=http%3A%...

Speed is now a major Google indicator, and many mobile users (now the majority) will not wait that long for a page to load.

Hope that helps answer your question, and I look forward to your PRB submissions,

John
italinux replied on at Permalink Reply
italinux
Thanks very much John

All good points,
I'll see what I can do

Thanks
italinux replied on at Permalink Reply
italinux
In fact this is a detailed output from Google Speed Insights
matteo@dellXPS13:/www/sbin$ psi matteo-montanari.com
  PageSpeed Insights with reporting
--------------------------------------------------------
  Today date: 2017/October/04
--------------------------------------------------------
URL:       matteo-montanari.com
Strategy:  mobile
Speed:     69
Usability: 100
CSS size                                   | 335 kB
HTML size                                  | 32.4 kB
Image size                                 | 413 kB
JavaScript size                            | 364 kB
CSS resources                              | 24
Hosts                                      | 2
jasteele12 replied on at Permalink Reply
jasteele12
Sure looks like shell access to me ;)

Like I said, not good results...
italinux replied on at Permalink Reply 2 Attachments
italinux
Hi John

I thank you a lot for your review.
I am getting considerably better .. before and after in attachment.

The very last thing I'll do, after improving coding, is to change hosting and yes I think I'll do it at some point.

Thanks again