Archive for the “PHP” Category

PHP upload: Files are assigned to nobody

PHP uploaded files will generally get uploaded with the user nobody when using mod_php. This is the apache module for PHP which means the file will be uploaded with the apache user. In order to work around this you can modify your code to chown the file to the appropriate ftp user. The best option is to use PHP in FCGI mode or install SuPHP. This will ensure the files will always upload using the folder owner id.

Using cpanel this can be installed using the easyapache tool.

May 11, 2010 Posted Under: CPANEL, PHP   Read More

Plesk Billing – internal error has occurred- license

Error:
When trying to activate the plesk billing license you receive a internal error message: ok , so what does this mean.. if you ask plesk , you will need to wait 72 hours for a answer. so this is why we have openkb.org

Reason: check and make sure fopen is on in the php.ini file and openssl has been compiled with php.

other error you may receive
You must have the OpenSSL extension enabled in your PHP installation in order to use Parallels Plesk Billing. You do not.
Invalid license data found in system. You need to update your license to a Parallels Plesk Billing 6.x license key. Please contact support for help with this process.

April 7, 2010 Posted Under: PHP   Read More

PHP 5.3 – Date warning

Wow, PHP is changing the way we code our websites

More Warnings
Warning: date() [function.date]: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘America/New_York’ for ‘EDT/-4.0/DST’ instead in

Solution :
date.timezone will need to be set within the php.ini file as
date.timezone = “timezone”
Supported timezones

Also Set the function date_default_timezone_set
Example date_default_timezone_set(‘America/Los_Angeles’);

March 17, 2010 Posted Under: PHP   Read More

PHP/IIS7 – IIS to return a 502 Bad Gateway

php-cgi.exe does work on IIS7. You need to modify PHP.INI to have the line:

cgi.force_redirect = 0

If you do not do this modification, PHP-CGI.EXE outputs a security warning response without proper response headers, which causes IIS to return a 502 Bad Gateway. Strangely, running PHP-CGI.EXE from the commandline does not generate this error – I guess using NPH CGI is the only way to debug PHP, because running it from the commandline is not 100% indicative of web-server Runtime behavior.

Tested using VC9 x86 Thread Safe PHP 5.3

January 16, 2010 Posted Under: PHP, Windows   Read More

PHP compression using gzip

The best way to compress PHP files is to use

auto_prepend_file

Add the filling code to a file called gzip.php

<?php

    if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'))

        ob_start("ob_gzhandler");

    else

        ob_start();

?>

Then update your php.ini files as follows

auto_prepend_file= /path/to/gzip.php

you can also use a htaccess file if your server permits

php_value auto_prepend_file gzip.php

Testing the compression

More detailed information on compressing files

January 10, 2010 Posted Under: PHP   Read More