For My PDF Generation I am using MPDF. But its not working in client's server. It shows no problem in my local system and my server. So I tried to change the max_execution_time, max_input_time, memory_limit in the ini file. But its not changing. When I used .htaccess it showed " For security reasons, mod_php is not used on this server. Use a php.ini file for php directives"..
I tried ini_set(), .user.ini file, php.ini file options. Is there any other way I can change the ini settings on the server?
Adding this specific line to .htaccess file reads the newly created php.ini file in that folder.
AddHandler application/x-httpd-php5 .php
Related
I am trying to install magento, here I came up with renaming a file name php.ini.sample to php5.ini. When I checked whether the file is reading or not I created a info.php file and uploaded to the server. Now the information shows as below:
Configuration File (php.ini) Path /etc/php54.ini.d/
Loaded Configuration File /etc/php54.ini.d/php.ini
Scan this dir for additional .ini files /etc/php54.d
etc/php54 is a server ini file. My file resides in the home/public file. The Scan this dir for additional .ini files dosent scan my php5.ini file I created and uploaded on the server. I am on a shared hosting plan 123-reg.co.uk. How do I turn things around here?
You cannot. The directory will be set during compilation (--with-config-file-scan-dir option). See http://php.net/manual/en/function.php-ini-scanned-files.php for more information.
Try to use .user.ini files (http://php.net/manual/en/configuration.file.per-user.php) or php_value and php_admin_value with .htaccess.
But remember: You cannot change everything, see http://php.net/manual/en/configuration.changes.php for details.
One can append his own inis by using
SetEnv PHP_INI_SCAN_DIR /path1/php.d/:/path2/
in virtual host at least for PHP 7.2
Another approach, Apache/php will in my case by default scan this dir too for ini /etc/php/7.3/apache2/conf.d , just symlink you custom php.ini file from where it is such as webroot, to this conf.d folder and restart apache
I want to load the file variables.php (that simply contains variables) at the run of any pages of my project so I can use the variables from any place.
I created a file called .user.ini (and placed it in the root folder):
; Automatically add files before PHP document.
; http://php.net/auto-prepend-file
auto_prepend_file = /Volumes/www/project_name/admin/libs/variables.php
It doesn't work. It seems that PHP doesn't read the .user.ini file.
php.ini is right configured by default:
user_ini.cache_ttl 300 300
user_ini.filename .user.ini .user.ini
Where am I wrong?
Well, the manual says it all:
Since PHP 5.3.0, PHP includes support for configuration INI files on a
per-directory basis. These files are processed only by the CGI/FastCGI
SAPI. This functionality obsoletes the PECL htscanner extension.
And:
If you are using Apache, use .htaccess files for the same effect.
... though it actually refers to the Apache module (mod_php).
If you need SAPI-independent custom settings I'm afraid you'll have to use both. You can minimise the maintenance burden if you keep those settings to the minimum (most PHP directives can be provided in PHP code itself). And you need to ensure that .htaccess settings don't crash when mod_php is not available:
<IfModule mod_php5.c>
php_value auto_prepend_file /Volumes/www/project_name/admin/libs/variables.php
</IfModule>
I think .user.ini should be located in project root folder, for example, /Volumes/www/project_name/.user.ini
In addition to the main php.ini file, PHP scans for INI files in each
directory, starting with the directory of the requested PHP file, and
working its way up to the current document root (as set in
$_SERVER['DOCUMENT_ROOT']). In case the PHP file is outside the
document root, only its directory is scanned.
.user.ini documentation
I cannot access php.ini file to edit max_input_vars.
How can I change it from my webroot? I had created php5.ini file within my root and added the following.
[PHP]
max_input_vars = 5000
But nothing happened.max_input_vars still shows its old value, 1000.
In GoDaddy shared hosting in Cpanel,
placing the following code by creating a new file .user.ini in root directory resolved the problem.
max_input_vars = 5000
Additionally, I also wanted to increase the file upload size, so, i created a php.ini file in public_html and placed following code:
[PHP]
file_uploads = On
post_max_size = 50M
upload_max_filesize = 50M
Thanks to #fyrye suggestion.
Just for clarification, putting code in .htaccess file to override php settings will most likely bring 500 internal server error in GoDaddy Shared Hosting.
Have you tried running as CGI and using .user.ini
http://www.php.net/manual/en/configuration.file.per-user.php
According to ini config settings this should work for you
http://php.net/manual/en/info.configuration.php#ini.max-input-vars
PHP_INI_PERDIR Entry can be set in php.ini, .htaccess, httpd.conf or
.user.ini (since PHP 5.3)
You may also need to go to your hosting processes in the godaddy control panel and restart all web processes.
Also see:
How to access the php.ini file in godaddy shared hosting linux
I tried to make an PHP upload form on a windows server, but the upload didn't work because there's no temporary directory. I checked which value is set for the upload_temp_dir and phpinfo() says "no value".
Is it possible to overwrite the php.ini settings for upload_tmp_dir on a IIS? I have no access to the php.ini file. I looked for a possibility to change it with help of a web.config file, but with no result.
have a look at the function
init_set()
http://php.net/manual/en/function.ini-set.php
You can change PHP config by creating a ".user.ini" file. For example, the following will enable the short open tag for your site:
short_open_tag = On
Upload the file to the root directory of your site.
If the PHP version is 5.3 or 5.6 the file name is: user.ini
For any other PHP version the file name is: .user.ini
I've tried going through Network Solutions tech support but didn't get it resolved ("You need to talk to Signature Support, which is $50").
I'm running some sites off of a Net Sol VPS account and need to change the upload_max_filesize setting (which is apparently set to a paltry 2MB by default) for the php server. I've added:
upload_max_filesize = 20M
post_max_size = 20M
max_execution_time = 6000
to the /httpdocs/cgi-bin/php.ini file (per NS's instructions), and then restarted apache, but when I run a phpinfo on that domain, the settings are not applied. It still says "2M" for the upload max.
I also tried adding this to the server root at /cgi-bin/php.ini as well, to no effect.
There is no /cgi-bin/.php/php.coalesced.ini file that I can see.
Any ideas? I'm losing my mind with this.
First thought is to check your phpinfo() output for the value listed in the "Loaded Configuration File" setting and make sure that it matches the file you've been editing.
You can't just litter PHP.ini files around and expect PHP to load them. If it's not been told to look for one in that cgi-bin directory, the file will just get ignored.
Check the phpinfo() output - the first section will tell you exactly what .ini files were located/parsed, and their location. e.g. on my home server:
Configuration File (php.ini) Path /etc/php5/apache2
Loaded Configuration File /etc/php5/apache2/php.ini
Scan this dir for additional .ini files /etc/php5/apache2/conf.d
Additional .ini files parsed /etc/php5/apache2/conf.d/curl.ini, /etc/php5/apache2/conf.d/gmp.ini, /etc/php5/apache2/conf.d/mysql.ini, /etc/php5/apache2/conf.d/mysqli.ini, /etc/php5/apache2/conf.d/pdo.ini, /etc/php5/apache2/conf.d/pdo_mysql.ini
if your cgi-bin .ini file isn't listed, then PHP is NOT looking in that directory.
I know this is old but figured I'd share my experience. I tried adding a php.ini file to the /cgi-bin folder as I read was suggested, that didn't appear to work. My solution was to SSH onto the server and make a change to the real php.ini file and then restarting the server.