Assalamualaikum, I would like to take this opportunity to wish all fellow Muslims a blessed Ramadhan and may this holy month leads us to humbleness, forgiveness, more good deeds, changing for a greater good, enhance our life and make us more pious. Happy Fasting and Worshipping lads.
Back to the agenda brought upon today, there might come a situation where you need to re-configure PHP’s setup on a web server. But here is the catch, for some unknown circumstances or some how you are restricted to do it on the php.ini (e.g: can’t find the php.ini file) file that is the configuration file for PHP.
Lets start with an example, for instance say we need the web server to temporarily display error that occurs on the running script. Basically you can do this by opening the php.ini and change
display_errors = Offtodisplay_errors = On
Save the php.ini file and restart the web server will surely do the trick. But then since the situation is that you can’t get through the php.ini file. You might do it via PHP Runtime Configuration.
Open your desired PHP script and add:
//Set Display Error Onini_set("display_errors","1");or//Set Display Error Offini_set("display_errors","0");
Save your script and re-run it and errors will start to show.
Bear in mind that not all of PHP’s configuration can be overwrite like this. This page here will list and show what and where can PHP’s configuration can be changed.
Based on the ‘PHP: List of php.ini directives’ page as stated above, you might notice under the ‘Changeable’ column they are labeled as:
PHP_INI_USERPHP_INI_PERDIRPHP_INI_SYSTEMPHP_INI_ALL
Each of this label means different ways of configuration.
The steps using ini_set() as we did earlier wont work for configurations such as:
upload_max_filesize (PHP_INI_PERDIR)post_max_size (PHP_INI_PERDIR)
As you can see these configuration are labeled as PHP_INI_PERDIR.
Based on the ‘PHP: Where a configuration setting may be set’ page here.
PHP_INI_PERDIR means ‘Entry can be set in php.ini, .htaccess or httpd.conf’
So for the case of ‘upload_max_filesize’, ‘post_max_size’ and all configurations labeled as PHP_INI_PERDIR can be set in your .htaccess file or the httpd.conf file (Apache’s configuration file).
Open up your .htacess file or your httpd.conf and add in as below:
php_value upload_max_filesize 20Mphp_value post_max_size 30M
Save and restart your web server and you are all good. So long story short, you can also configure PHP without php.ini by doing it at the .htaccess or the httpd.conf.
p/s:
>./configure -prefix=/month/ramadhan/1432h
-enable-sahur
-enable-fast
-enable-brake-of-fast
-enable-tarawih
-enable-quran-recite
-enable-zakat-al-fitr
>make
>make install


