apache linux OS php Plesk programming Quick Tips servers

PHP failing to upload images on a Plesk managed server

I recently upgraded a few of my Linux servers from Plesk 7.5 to 8.2. Everything seemed to be fine, however calls started coming in about PHP forms not uploading images correctly.

My team and I were troubleshooting this problem for a few days trying to narrow down the problem. We looked at folder permissions, script permissions, database connectivity, and almost anything else we could think of. Then we stumbled across the error message given by PHP (who would have thought to look at the error message?) that said function move_uploaded_file will not work in safe_mode.

Now looking at the PHP info the main php.ini was set with safe_mode off. However, I found that the httpd.conf for the individual domains on a Plesk managed server carries a declaration for PHP safe_mode, and it was turned on. Upon further investigation I found that in the Plesk interface for the domain there is a checkbox beside the PHP setting that allows safe_mode to be turned on and off.

Mission accomplished!

linux php programming servers

Upgraded a server to PHP 5 from PHP 4

Everything went pretty smooth while upgrading a server for a customer. I was moving them from Fedora Core 3 to Fedora Core 4. This also meant that PHP 5 was installed instead of PHP 4, and MySQL 4.1 was installed instead of MySQL 3.23. All was working smoothly except one of the websites on the server was having some major issues. The pages would not display, and $HTTP_POST_VARS and $HTTP_GET_VARS were not working correct.

I did not design the site, so I was not familiar with how the $_POST and $_GET were used within the code. After opening the files I quickly saw the problem. In the PHP.ini there is a new setting that, by default, only looks for the short forms of these predefined variables. In other words, it doesn’t know what $HTTP_POST_VARS or $HTTP_GET_VARS are. But it recognizes $_POST and $_GET with no problem.

After changing the setting in the PHP.ini all is working fine. Luckily the previous programmer did an ‘ok’ job.

The setting in the PHP.ini that needs to change is:

register_long_arrays = Off

This is located in the “Data Handling” section about 1/3rd of the way down the file. (If you followed the default installation of Fedora Core 4.)