Archive for the ‘PHP’ Category



IonCube error on 64 bit server

Friday, January 22nd, 2010

On a 64 bit dedicated server we came accross an error:

[root@server ~]# php -v
Failed loading /usr/local/ioncube/ioncube_loader_lin_5.2.so:
/usr/local/ioncube/ioncube_loader_lin_5.2.so: wrong ELF class: ELFCLASS32

If you come across such issue it seems that you have installed the wrong version of the IonCube Loader. For 64 bit remember to use the path /usr/lib64/php/modules/ioncube

I hope this helps you!


Check if a PHP function name if available on dedicated linux server

Thursday, November 20th, 2008

If you have your site hosted on a linux based dedicated server and are looking if the “php function” that you need is available or not on the server, a small piece of php code can help you find it. You have to created a file for ex. functions-in.php and add the below code in it – further browse the file in your favourite browser. http://www.yourdomain.com/functions-in.php

<?php
if (function_exists('FUNCTION_NAME')) {
echo "Function is available.<br />\n";
} else {
echo "Function is not available.<br />\n"; }
?>

It will display the result within your php page.

This article is released by SupportFacility.Com — the leaders in providing outsourced technical support, live chat support & help desk support for web hosts. Interested ? Opt for a trial now.


Timezone for PHP scripts

Wednesday, September 24th, 2008

If you only want particular PHP scripts (and not shell or other cgi scripts) to use a specific timezone, set the timezone environmental variable in your PHP code like so:


<?
echo "Original Time: ". date("h:i:s")."\n";
putenv("TZ=US/Eastern");
echo "New Time: ". date("h:i:s")."\n";
?>

If you put the line putenv(“TZ=US/Eastern”); in a file that is include()’ed by all your other PHP scripts, then your all PHP scripts will use that timezone.

This article is released by SupportFacility.Com — the leaders in providing outsourced technical support, live chat support & help desk support for web hosts. Interested ? Opt for a trial now.


Disk space commands on linux

Tuesday, July 1st, 2008

Linux console is the best place for a system admin, some useful commands to check disk space on a linux system are:

Show files by size, biggest last:

ls -lSr 

Show top disk users in current dir.

du -s * | sort -k1,1rn | head

Show free space on mounted filesystems

df -h

Show free inodes on mounted filesystems

df -i 

Show disks partitions sizes and types

fdisk -l

List all packages by installed size (Bytes) on rpm distros

rpm -q -a --qf '%10{SIZE}\t%{NAME}\n' | sort -k1,1n

This article is released by SupportFacility.Com — the leaders in providing outsourced technical support, live chat support & help desk support for web hosts. Interested ? Opt for a trial now.


Disable exec PHP function on cPanel server

Monday, May 26th, 2008

On a cPanel server there is always security risk of PHP functions for eg. exec if you want to disable this function on your cPanel server you can do so from your servers php.ini

You can find the php.ini of your server by the following command:

root@server# php -i | grep php.ini
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini

Then, edit that file and search for disable_functions and add the function exec in front of that.

That’s it!

This article is released by SupportFacility.Com — the leaders in providing outsourced technical support, live chat support & help desk support for web hosts. Interested ? Opt for a trial now


PHP fatal error: session_start()

Tuesday, May 20th, 2008

For some reason for a PHP script if you get such error:

“Fatal error: session_start()”

Or

“Warning: session_start() [function.session-start]“

Add this line in your .htaccess file:

php_value session.save_path /tmp

And try now, make sure that the session path in your program is /tmp if it is something other you can set it to your session path – this worked for me.

Best of luck!

This article is released by SupportFacility.Com — the leaders in providing outsourced technical support, live chat support & help desk support for web hosts. Interested ? Opt for a trial now


Disable PHP error_reporting

Tuesday, April 22nd, 2008

You must have come across PHP errors like NOTICE , WARNINGS etc… and you need to disable this so this is not shown in your PHP page. To do so you can add a simple code within your PHP file. The code is:

error_reporting(0);

That’s it!

This article is released by SupportFacility.Com — the leaders in providing outsourced technical support, live chat support & help desk support for web hosts. Interested ? Opt for a trial now.


Make PHP to work in your HTML files with .htaccess

Sunday, September 23rd, 2007

Most of the web servers across the internet are configured to treat PHP files that end with .php. If you need to have your HTML files parsed as PHP (e.g .html) or even if you want to take it further and make your PHP files look like ASP, you can do the following:

- For web servers using PHP as apache module:

AddType application/x-httpd-php .html .htm

- For web servers running PHP as CGI:

AddHandler application/x-httpd-php .html .htm

This article is released by SupportFacility.Com — the leaders in providing outsourced technical support, live chat support & help desk support for web hosts. Interested ? Opt for a trial now.