Author Topic: Can't add new media - bug with PHP 7  (Read 2623 times)

biltong

  • Jr. Member
  • **
  • Posts: 129
    • Starfish Websites
Can't add new media - bug with PHP 7
« on: April 18, 2016, 17:59:36 pm »
I think this is an issue with the /tmp directory showing as unwriteable with PHP7 at the bottom of the media edit page.

With PHP5.6 it is showing as writeable.

Attached screenshot shows page after selecting an image to upload, clicked Upload radio button then Save button.

J 3.5.1
VM 3.0.14
PHP 7.0.4

escapezone

  • Beginner
  • *
  • Posts: 24
Re: Can't add new media - bug with PHP 7
« Reply #1 on: April 18, 2016, 23:00:57 pm »
Are you sure that with PHP5.6 you can add images?

I had a similar problem and i tried Joomla 3.5.1 , Virtuemart 3.0.14,  PHP 7.04 and  Database Type Mysqli and everything solved... (As you understand the problem was when i had Mysql PDO i don't know why but that solved my problem)

The only problem that i had now is that when i am uploading an image i get the following error

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Img2Thumb has a deprecated constructor in /var/www/vhosts/mydomain.gr/mysite/5/administrator/components/com_virtuemart/helpers/img2thumb.php on line 20

Do you have this error too ?

Regards,
Pagona

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4608
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Can't add new media - bug with PHP 7
« Reply #2 on: April 19, 2016, 03:32:59 am »
virtuemart queries is not Mysql PDO complient.
It's only some queries, i reported already it, but i had no answer it someone in team check for this.

biltong

  • Jr. Member
  • **
  • Posts: 129
    • Starfish Websites
Re: Can't add new media - bug with PHP 7
« Reply #3 on: April 19, 2016, 10:41:34 am »
Are you sure that with PHP5.6 you can add images?

Yes,  I can add images with php 5.6 - see attached screenshots confirming this.

I'm not getting this error:

Quote
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Img2Thumb has a deprecated constructor in /var/www/vhosts/mydomain.gr/mysite/5/administrator/components/com_virtuemart/helpers/img2thumb.php on line 20

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10213
  • VM3.9 Eagle Owl
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Can't add new media - bug with PHP 7
« Reply #4 on: April 19, 2016, 11:45:15 am »
We "fixed" it already. So long, just disable the error reporting and anything works again.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

biltong

  • Jr. Member
  • **
  • Posts: 129
    • Starfish Websites
Re: Can't add new media - bug with PHP 7
« Reply #5 on: April 19, 2016, 12:18:57 pm »
We "fixed" it already. So long, just disable the error reporting and anything works again.

I've changed Joomla Error Reporting to None and still get the same problem with PHP 7 using VM 3.0.14. Was this fixed in 3.0.16?

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 10422
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 3.6.8
Re: Can't add new media - bug with PHP 7
« Reply #6 on: April 19, 2016, 12:37:27 pm »
Why aren't u on 3.0.16 which is for J3.5.1 ?
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 28308
  • Always on vacation
    • Jenkin Hill Internet
Re: Can't add new media - bug with PHP 7
« Reply #7 on: April 19, 2016, 12:39:50 pm »
I believe 3.0.14 was not fully PHP7 or J3.5.1 compatible, as covered here many times.  VM3.0.16 is the one to use atm.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VirtueMart 3.8.9.10473 on Joomla 3.9.28 PHP 7.4.14

biltong

  • Jr. Member
  • **
  • Posts: 129
    • Starfish Websites
Re: Can't add new media - bug with PHP 7
« Reply #8 on: April 19, 2016, 14:58:33 pm »
OK thanks for the heads-up, I'll upgrade to 3.0.16 to see if that resolves this issue.

jenkinhill, I hear what you say but I've been on this forum countless times in the past few weeks and not seen anything saying that 3.0.14 is not PHP7 compatible and that 3.0.16 specifically resolves issues with PHP7.

I think I'm like most forum visitors, wearing blinkers focused on my specific VM issues so don't have the wider vision of everything that you Heros see and help with, which I appreciate immensly!

Milbo, surely spending a little time on an informative Twitter message and maybe a News article announcing 3.0.16 with information on what it fixes, is a better use of time than answering queries like mine?

My comments are meant to be positive so please don't take offense.

biltong

  • Jr. Member
  • **
  • Posts: 129
    • Starfish Websites
Re: Can't add new media - bug with PHP 7
« Reply #9 on: April 19, 2016, 16:08:32 pm »
So I've upgraded VM to 3.0.16 and using PHP 7 still had the same problem.

With Joomla Error Reporting set to Development, I have noticed this message on the Media Edit page:

"Warning: is_writable(): open_basedir restriction in effect. File(/tmp) is not within the allowed path(s): (/home/xxxxxxx/public_html) in /home/xxxxxxx/public_html/administrator/components/com_virtuemart/helpers/mediahandler.php on line 375"

and this at the bottom of the page:

/tmp :: Unwriteable
/home/xxxxxx/public_html/images/stories/virtuemart/typeless/ :: Unwriteable
/home/xxxxxx/public_html/images/stories/virtuemart/typeless/resized/ :: Unwriteable


 ::)

I then noticed that my PHP 7 Settings has open_basedir set to /home/xxxxxxx/public_html and no value for PHP 5.6.

This was restricting VM access to /tmp which I assume VM uses as a temporary upload destination.

I was thinking that /tmp was relative to the website root, i.e. public_html/tmp

So, no problem with VM and PHP 7 in this case  :-[

Thanks for your help.

biltong

  • Jr. Member
  • **
  • Posts: 129
    • Starfish Websites
Re: Can't add new media - bug with PHP 7 / open_basedir
« Reply #10 on: April 19, 2016, 16:21:53 pm »
It would be useful to know what the developers' view is on using open_basedir, which is suggested on the Joomla Security Checklist https://docs.joomla.org/Security_Checklist/Hosting_and_Server_Setup.
  • Obviously it causes the problem I experienced above and there is no way to configure an alternative location for /tmp in VM
  • and setting a value for open_basedir above public_html means that the vmfiles directory must be moved from the 'default' suggestion below public_html

This post http://stackoverflow.com/questions/13772065/how-to-setup-open-basedir-in-php-for-joomla suggests setting it to
Code: [Select]
open_basedir = /home/users/you/public_html