0

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_replace( $_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?

2
  • 3
    Maybe if you explained WHY you need to see the installed php.ini someone could help you with an appropriate solution. Commented May 17, 2010 at 5:29
  • i want to change the upload file size in that php.ini file. I have tried another ways like changinh .htaccess file, but it resulted in 500 internal server error. and i have tried changing httpd file, but it has no effect. now i'm trying to chage the php.ini file Commented May 17, 2010 at 5:33

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

That begs the question if it possible to achieve the desired effect (increasing upload file size) using file .htaccess (usually enabled on that kind of hosting). Can you expand your answer to cover that?
@PeterMortensen This may be helpful a2hosting.com/kb/developer-corner/php/…
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.