php.ini

PHP SYSTEM WARNING: ‘date(): It is not safe to rely on the system’s timezone settings

Edit /etc/php.ini and add the timezone setting within the file. For a list of timezone settings, visit http://php.net/manual/en/timezones.php


[Date] ; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = America/New_York

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

PHP: ‘Fatal error: Allowed memory size of 8388608 bytes exhausted’

Reason why you see this message is due to PHP memory leakage. PHP is trying to load a large image or file into memory and is not finding enough space for it to load.

If you think, that you will need the necessary feature to upload large files then there are two ways by which you can enable this feature.

i) Edit the physical file and have the line
ini_set(“memory_limit”,”20M”);

ii) Edit php.ini and add the following line. You need to restart the apache/IIS server once php.ini file is modified.
memory_limit=32M

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

PHP: What is PEAR?

PEAR stands for PHP Extension and Application Repository.

To learn more about the PEAR library click here

If you are beginner, the following link will help you tread with the library usage PEAR Manual

Installation instructions clearly walks through the steps for PEAR configuration. There may be cases where you may want to use PEAR libraries for specific projects only in which case you can install PEAR library for that specific purpose. To use it in projects, PEAR path should be set in php.ini settings or should be included in the project configuration’s physical path.

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

PHP removing deprecated related errors from display

To remove deprecated warning message displays when executing PHP programs, open php.ini file and ADD to it

error_reporting = E_ALL & ~E_DEPRECATED

This is the setting for the production environment where you would not like to display the deprecated function related errors.

Sample error message
Assigning the return value of new by reference is deprecated in nusoap.php on line 7381

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

How to turn off register_globals via php.ini?

It is always secured to turn OFF register_globals in PHP applications. Earlier, we have seen how to turn OFF register_globals setting via .htaccess file and in this blog we will use php.ini instead.

Using a text editor create a file called php.ini. This will be our first step.

Next, we need to add the following line of code in php.ini
register_globals = off

Upload php.ini file to the root folder where your application resides.

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

PHP: Fatal error: Maximum execution time of 30 seconds exceeded

This error happens when the execution time of the PHP script exceeds the time limit for program execution in Php.ini file.

By default the timer is set to 30 seconds in php.ini and you can track the time limit by tracing for ‘max_execution_time’ directive in php.ini.

A quick way to find the execution time set for PHP is to check the phpinfo() function.

Solution:
You can set the time limit by issuing “set_time_limit(60);” statement to increase the time limit.

A better way would be trace where the bottlenecks are in the program to identify what causes the time lag. Possible causes may be

* Poorly structured queries
* Never ending iterations
* Read lock on files when they are opened by multiple sources etc.

Share it onShare on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn
Kurinchi Calendar
May 2017
M T W T F S S
« Apr    
1234567
891011121314
15161718192021
22232425262728
293031