In the afternoon I went on Animal Crossing and then did some website work. I found that when uploading an image to my site, the post array would be empty. After some testing and googling I found that it has to do with the "post_max_size" and "upload_max_size" settings in php.ini. If the image/post data exceeds these limits, the $_POST and $_FILES arrays become empty. Unfortunately PHP doesn't seem to throw an error (at least it doesn't show), so it just leaves you wondering what's happening.
After changing those settings to reasonable figures, I found that I was getting an error
Fatal error: Class 'Imagick' not found
I did some checking and it seems that I don't have the ImageMagick php extension installed on my Ubuntu virtual machine, and my webhost doesn't seem to have it installed either.
I wanted to check if my webhost had ImageMagick installed, but just didn't have the php extension installed, so I tried to write a php script that sent a command to the shell to see if the ImageMagick package was installed. I used the example here: Find out if package is installed in Linux, but unfortunately all I was getting was nothing (not even an error). Executing the same command from the shell worked fine. I tried back ticks `,
shell_exec
and exec
, but all were the same.So I did some googling, and one of the suggestions was to check the apache error logs. So I did this, and found I had a lot of errors about ZendExtensionManager.so not being found. I checked where it was looking, and sure enough it wasn't there. I searched the whole filesystem for ZendExtensionManager.so, but it wasn't anywhere. So after more googling and reading, I installed Zend Optimizer. The installation didn't seem to go very well as it couldn't find different files, etc. but after installing php still seemed to work okay and I didn't seem to be getting the error about ZendExtensionManager.so being missing any more.
I saw an error in the logs saying that dpkg was an unrecognised command or sumat, so I spent probably a couple more hours messing about and then eventually found this great php function that gives you the shell error message if a command doesn't work.
Using that function, I found that dpkg would only when called from my php script if I called it with the full path like /usr/bin/dpkg. But then I would get an error about dpkg-query not being found. I tried cding to the /usr/bin directory, and then executing dpkg from there in my script, but still got the same error. So what I had to do was to call /usr/bin/dpkg-query instead, and then it worked okay.
However, on the webserver, both dpkg and rpm didn't seem to work. After more googling and messing around I changed my script so it would check if dpkg or rpm were in the /usr/bin directory. Neither were on the webserver. I did an
rpm -qa
(I think) on the webserver, and was interested to see that Python was installed. No sign of ImageMagick (or Django) though.I decided to look at different webhosts to see if there was one at a reasonable price that lets you install/will install for you any extensions and programs you might need. I found webfaction, who say they let you compile any programs you want in your home directory. I'm not quite sure how much freedom this actually gives you. I'll have to look into it tomorrow. I might also see if it is possible to do the same thing with my current host. Although I don't have shell access, I can try issuing the commands through a php script.
In the evening I also watched War with Mac, which was totally skill. Jason Statham and Jet Li fighting each other!!!!!
The weather today was hot and sunny all day. There weren't any clouds around at sunset.
Food
Breakfast: Bowl of Maple & Pecan crunch oat cereal; cup o' tea.
Lunch: Beef with mustard, sliced raddish, sliced cucumber and iceberg lettuce sandwich; satsuma; banana; caramel Rocky; cup o' tea.
Dinner: cheapo sausage; delee sausage; mashed potato; baked beans. Pudding was tinned peach slices with apricot yoghurt.
No comments:
Post a Comment