'php.ini' file creation on server
I am developing a PHP website, but I can’t see the php.ini file on my server. My host will not provide it.
So I'm now going to create a copy of that php.ini file.
So I have tried system()
.
I searched in Google and I found Creating a custom php.ini using the server default php.ini and configuration settings.
Here they are using it like this:
system("cp /usr/local/php5/lib/php.ini /home/YOURUSERNAME/php.ini");
On my server when I looked at the phpinfo(), my php.ini location is:
/ms/svc/php5/conf/php.ini
And when I looked for the current directory of my server using
$dir_path = str_replac开发者_如何学运维e( $_SERVER['DOCUMENT_ROOT'], "", dirname(realpath(__FILE__)) ) . DIRECTORY_SEPARATOR;
I got my current directory as:
/netapp/whnas-swamp/s11/s11/01712/www.sample.com/webdocs/
So my system command will now look like this:
system("/ms/svc/php5/conf/php.ini /netapp/whnas-swamp/s11/s11/01712/www.sample.com/webdocs/php.ini");
I have named this page getthephpini.php.
And when I browsed this page I got a blank page, but no new php.ini file created in my server.
Is any mistake in that code? What is the correct way?
A properly configured PHP installation will not give you physical access to php.ini from your PHP code.
What you are trying to do is not possible.
What you are looking for is this command that lets you change the settings from within PHP code.
ini_set('upload_max_filesize', '64M');
Editing php.ini directly (even if you had access to it) would likely not have worked, because the web server would need to be restarted for the setting to take effect.
精彩评论