简体   繁体   中英

How to access the php.ini file

I need to change some variables in the php.ini file to be able to upload files. I bought a domain & hosting, and i access it through FileZilla. Usisng phpinfo() I know

Configuration File (php.ini) Path is /usr/local/php/p56

Loaded Configuration File is /usr/local/directadmin/data/users/kristak/php/funwithhakase.pl/php56.ini

I don't know which of these files should I access and how to change the desired variables. I tried putting the adresses into FileZilla, but nothing appeared. Pls help :)

Properly you are not able to access the php.ini file. Maybe you can change some settings in your hosting backend. Otherwise contact the support of your hosting provider.

First - you should see your hosting documentation regarding specific access / permissions. You also did not mentioned what control panel you are using ( whm, cpanel, plesk , virtualmin, custom )

As for runtime :

You can use ini_set in order to change some of the runtime variables.

It might not be available with your hosting, but you can always try ( most hosting that I have encountered allow it to some degree )

Likewise, you can use ini_get to see current values, for example to know what is the upload_max_filesize that is currently used :

echo 'upload_max_filesize = ' . ini_get('upload_max_filesize') . "";

and to set it :

ini_set('upload_max_filesize','1024M');

or with error suppression :

@ini_set('upload_max_filesize',$my_Value);

Depending on your hosting, you could potentially do that with most variables of the ini file :

ini_set('max_execution_time','10');
ini_set('memory_limit','1024M');
ini_set('post_max_size','1024M');

Another way ( again - hosting permitting ) is to use .htaccess

Syntax is a bit different

php_value upload_max_filesize "80M"
php_value post_max_size "80M"
php_value max_execution_time "2000"
php_value memory_limit "150M"

Under some hosting that permit - you can actually put per-folder user.ini \\ .user.ini or php.ini \\ .php.ini with the values you want to override - but again, best is to consult hosting documentation.

If you want to make sure to know where is the used ini you can also try

<?php echo php_ini_loaded_file(); ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM