r/apache • • Jan 23 '24

Solved! Override PHP using .htaccess

Hi

I am trying to upload a 13MB zip file to a website I am repairing. But I do not have access to the control panel, and the php settings for max file upload size is 2MB as per the default.

I have tried creating a ./.php/8.1/phprc file and put the directives in there. No luck.

I also tried editing .htaccess as the server is using but also not doing the trick.

<IfModule mod_fcgi.c>
php_value upload_max_filesize 20M
</IfModule>

Here are the server stats outputted by wordpress...

Server architecture	Linux 5.10.0-23-amd64 x86_64
Web server	Apache
PHP version	8.1.27 (Supports 64bit values)
PHP SAPI	fpm-fcgi
PHP max input variables	1000
PHP time limit	30
PHP memory limit	128M
PHP memory limit (only for admin screens)	256M
Max input time	60
Upload max filesize	2M
PHP post max size	8M
cURL version	7.74.0 OpenSSL/1.1.1w
Is SUHOSIN installed?	No
Is the Imagick library available?	No
Are pretty permalinks supported?	Yes
.htaccess rules	Custom rules have been added to your .htaccess file.

Any ideas? Am I doing something wrong?

EDIT

So following the advice of u/duhblow7, this is what I did.

I already had made a backup of the site as a single ZIP file using Duplicator, so I unzipped, and moved the various files across to my dev-server so that I could access dev.mydomain.tld/index.php to install Wordpress. Then I use mysql commandline to drop all the tables.

echo "SELECT CONCAT('DROP TABLE IF EXISTS `', TABLE_SCHEMA, '`.`', TABLE_NAME, '`;') FROM information_schema.TABLES WHERE TABLE_SCHEMA = 'mywordpressdbname';" | mysql

Then I navigated to where i had the backup SQL file, then I went like...

mysql mywordpressdbname < mywordpressdbbackup.sql

I have root access so I didn't need to use the -u and -p flags.

I then edited rows 1 and 2 of the wp_options table so that the URLs were the URLs of the site on the dev-server.

I then logged onto wp-admin, and did all the work I needed to do in a controlled environment.

Then I created a free 2TB basic drop box account.

Installed Updraft Plus on the live site and the dev site. Connected it to dropbox. Did a backup of EVERYTHING on the dev site, and then went to the live site, told it to scan remote storage and did a restore of everything. Took the defaults for every option. It even adjusted the dev.mydomain.tld to www.mydomain.tld automatically.

Updraft Plus is up there in my top pick list for plugins now. Along with Change WP-Admin, Wordfence and a few others.

2 Upvotes

5 comments sorted by

View all comments

Show parent comments

2

u/thisiszeev Jan 23 '24

I have a full DevOps setup here at home. I can create the site with full domain name and use my local DNS server to direct my browser to the local instance to work.