php5 and mysql 5 - my experience

Support/Development for PHP
faris
Long Time Forum Regular
Long Time Forum Regular
Posts: 2321
Joined: Thu Dec 09, 2004 11:19 am

php5 and mysql 5 - my experience

Unread post by faris »

Just in case anybody is interested (especially from a Plesk perspective) I've been experimenting with php5 and mysql5 as downloaded from the centosplus repo on Centos 4.4

At first I thought I had a bit of a disaster on my hands but it all worked out in the end.

1) Using the Plesk migration manager to import a site onto the test server I experienced a "cannot deploy database" error. Manually importing the database exposed the error: The database in question was used to store images. Quite big ones. adding set-variable=max_allowed_packet=2M in my.cnf solved that problem.

2) I was using the pear DB functions for this site. But the default include path in php.ini was basically nothing. Changing it to ".:/usr/share/pear" solved this issue.

3) The site still refused to display the images in the database with no errors shown or logged. Checking php.ini showed that by default errors are not displayed for security reasons. Switching them on caused more problems - lots of notices regarding undeclared variables and suchlike and still no images. Adjusting the error display to something sensible cured all the errors AND resulted in some but not all images being displayed (the error messages were being added to the image stream and this corrupting them which is why none were showing initially).

3) The problem with some images not being shown was due to their size. My code is not particularly efficient and as hinted at with the first problem some of them are 2Mb or so. Changing memory_limit=32 (from 2) solved the problem and now everything works.

I hope this helps someone one day - I went without sleep for a whole day because of this but I got there in the end.

Of course I should not be allowing image files that are so big to be stored in the database. I should first resize them to the maximum size that will ever be displayed, then create a thumbnail and store that too. But oh no, I decided to allow ther user to upload a big one and store the whole thing and generate thumbnails on the fly. The problem was that I wasn't really sure where I was going with this script so I wanted to keep myself flexible. I think I may write a resize script to get the big images back into proportion, and re-write the file upload code to do things a little more sensibly.
Danny
Forum User
Forum User
Posts: 59
Joined: Mon Apr 11, 2005 3:48 am

Unread post by Danny »

Plesk 8.1 a few vBulletin sites, PHP 5.2.1 compiled by hand (only with the new mysqli), MySQL 5.0.27 from CentosPlus channel. I have this setup from 1 month ago.

I dont have notices about any error or warning in my plesk panel.
All work without errors, the error_log is clean, only normal errors, about 404. :P
Post Reply