How to edit php.ini values using PHP functions?
217
I currently using online server and i need to enable thecURL
module (change ;extension=php_curl.dll to extension=php_curl.dll in php.ini file). But this file is not accessible and not editable for that online server. How to solve this problems using PHP functions?
Answer
Solution:
You might want to have a look at
ini_set
.PHP Doc link: http://www.php.net/manual/en/function.ini-set.php
Also, as they say in the documentation:
Answer
Solution:
The author's real reason for wanting to ini_set() directives dynamically is to access a statically compiled library (curl) in a shared hosting environment. This is not possible in the case of a library which MUST be statically compiled into PHP. The answers are valid for the title of the question but not for the description as what he's attempting to achieve seems impossible given those constraints.
However, you can use the dl() function to dynamically load modules at runtime (if they are not static) http://de1.php.net/manual/en/function.dl.php.
However, curl needs to be statically compiled into PHP...
Perhaps if you just need to make a HTTP request, try file_get_contents (http://php.net/manual/en/function.file-get-contents.php), you rarely need curl in practice.
Answer
Solution:
You can use the php's ini_set();
an example::
Check with your hosting provider to enable curl module.