Webemania | PHP ini configuration

| Published Date: 22 May 2012 | Last Updated Date: 04 Sep 2017
Total Reads: 110,628 | Last Visit: 22 Sep 2017 06:09:47 AM

Case Study

  • Your php scripts contains many inputs fields and also so many logics. When you execute your scripts its gives a fatal error: PHP Fatal error: Maximum execution time of 120 seconds exceeded in C:\wamp\www\phptest\test.php on line 101
  • You want to upload your database to server using phpmyadmin. You select your sql files and when click upload it gives a fatal error : PHP Fatal error: Files exceeds it Maximum upload size.

The solution is

Configure your php.ini file

NoteThere are some basic php configurations that a php programmer should know. Let’s talk about these configurations.


PHP ini file location

If you have wamp installed in c drive then go C:\wamp\bin\php\php5.2.6 as shown in below and open php.ini file



You can go directly by clicking wamp tray icon as shown in below. In this case, you have to run wamp server


Now we have our php.ini file ready. So lets do the following

 PHP short open tag

You must off the php short tag for the following reasons

  • Using short tags should be avoided when developing applications or libraries that are meant for redistribution, or deployment on PHP servers which are not under your control, because short tags may not be supported on the target server.
  • For portable, redistributable code, be sure not to use short tags.
  • If you are sharing your code (open source etc.), some users might use them on a host which does not support PHP short code. So do not use short tag.
  • Generates confusion with XML declarations. Your code will break, and you will have very very hard time figuring out why.

  • <% %>, the ASP opening tag! Probably one of the most idiotic 'features' in PHP – the ability to write PHP code with ASP opening tags. Avoid anything idiotic.
  • Even the creators of PHP are suggesting not using short tags. Infact, short tags will be gone in PHP 6. Make your code future-proof.

So keep
short_open_tag = Off

Maximum execution time

Suppose you are running a script that takes more time (more than 30 seconds and your assigned time is 30 seconds) to execute. It gives you a php fatal error : "maximum execution time exceeds" and your script stopped running. So increase execution time
max_execution_time = 60 or max_execution_time = 120

Maximum Input time

Maximum amount of time each script may spend parsing request data. If you think your are running a big script then increase input time.
max_input_time = 60

Memory limit

Maximum amount of memory a script may consume
memory_limit =512M

Display errors

In order to see errors that your scripts generates then keep it on
display_errors = On

Log errors

Keep it on if you want to save any php errors in a file for future use.
log_errors = On

Error log

Location of error log file. Default error log file location is c:/wamp/logs. If you want to some where else than default location change it.
error_log = c:/wamp/logs/php_error.log

Post Maximum Size

Maximum size of POST data that PHP will accept. If your scripts contains audio or video data then increase it
post_max_size = 8M

Upload Maximum Size

Maximum allowed size for uploaded files. If Your scripts contains audio or video data then increase it
upload_max_filesize = 20M

Error Reporting

Suppose you are new in PHP programming and you want to see all sorts of error that your scripts generates then keep it E_ALL. Remember that, keep it on only for development environment , not in production environment.
error_reporting = E_ALL

Restart Wamp

After successfully changing above php configuration, save the file.

Now don't forget to restart your wamp server


Checking Changes value

To see the changes value, go to http://localhost/?phpinfo=1 and see your recently changes php value.



love fishing and camping doors

Hello! Running wind and success on the road!

Самый лучший фотошоп онлайн saku.ru,
на русском.

They are specially designed to eliminate harsh blue light while enhancing the colors you need to work the river with precision.

Pool parties are the best part about [Vegas].

Schau die private web cam http://webcam-sex.xyz . Immer online



latex cv

Order Dapoxetine Tablets Online USA on PureVolume
Show more!

Check my recent devise
polymaths kanpur zaman authors techno

per acquistare il viagra serve la ricetta medica|

301 Moved Permanently
Show more!

超強女用催情液 http://male-supplies.com/product/cayenne-super_female_aphrodisiac/

best cryptocurrency to buy now bytecoin forum

Post new comment

The content of this field is kept private and will not be shown publicly.
Max length 128 characters
Enter the characters shown in the image.

About This Mania

Hasan Hafiz, Blogger at web mania ltd (www.webemania.com). He has more than 5 years experience in web development platform. He worked as a Sr. Software Developer at Canadian based outsourcing software firm, Lead Developer at countries top most VOIPswitch development company and Sr. Software Engineer at USA based outsourcing software firm . His expertise areas are PHP, MySQL, CSS, Javascript, JQuery, HTML, XML and MVC Framework Codeigniter. He has been along with Drupal from more than 4 years. You may call him Drupal Addicted.