The content of .htaccess is:
php_value upload_max_filesize 64M
Works on localhost, screws up every hosting server I upload it to. The error.log says: Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
Is there another way to change the upload_max_filesize?
Clear your browser cache and cookies Check these articles on deleting the cache on an Android phone or iPhone, if you use a mobile device. Alternatively, you can test opening the page from another browser. For instance, if you use Chrome, try Firefox or vice versa.
PHP Coding Timing Out If your PHP script makes external network connections, the connections may time out. If too many connections are attempted and time out, this will cause a "500 Internal Server Error." To prevent these time outs and errors, you'll want to make sure that PHP scripts be coded with some timeout rules.
htaccess is a configuration file for use on web servers running on the web apache server software. when a . htaccess file is placed in a directory which in turn loaded via the Apache web server, then the . htaccess file detected and executed by the Apache server software.
If php_value
is not recognized as a valid command, it may be because PHP is not installed as an Apache module. Create a php file with the following contents:
<?php phpinfo();
Run the file to show your PHP configuration. Search the page (Ctr+F) for "mod_php". If you don't find it anywhere, this explains your problem.
If you have access to php.ini
, you may be able to fix your problem by editing that file instead. At the phpinfo
page, look at the value under Loaded Configuration File
for the location of the file to edit. On Linux, it will be something such as /usr/local/lib/php.ini
Open the ini
file (it's just a text file) and look for the setting you want to change. If it's not present, just add a line and set it as desired: upload_max_filesize=64M
Save the file and restart the Apache server.
If you don't want to remove the php_flag
command in .htaccess
but want to avoid the error, wrap the command as follows:
<IfModule mod_php5.c>
php_flag display_errors 0
php_flag display_startup_errors 0
</IfModule>
If you're using PHP7, use <IfModule mod_php7.c>
For other readers with the same problem and access to the server, this could also be caused by a misconfiguration of PHP as a module of apache. You can fix it reinstalling the module (or configuring the route to libphp.so
by yourself in php.ini
).
Have in mind that purge will remove the configuration of the packages which usually is nothing to worry, but you are warned just in case.
sudo apt-get purge libapache2-mod-php libapache2-mod-php7.2
sudo apt-get install libapache2-mod-php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With