My firts question, so any feedback is appreciated
I want to use GCP WordPress click to deploy VM to host a personal WordPress site. The problem I have is when I try to upload a theme. I’m getting the message: The uploaded file exceeds the upload_max_filesize directive in php.ini.
I have not been able to find and therefore edit the php.ini file.
So the questions:
How do I increase the file limit on a GCP VM WordPress click to deploy?
Where do I find the php.ini file?
I also have tried to upload the theme manually but Im worried that later I will have issues for not being able to upload more than 2mb files.
Any help would be appreciated
The details of the virtual machine:
e2 micro
29 gb persistent standart disk
I have tried the solutions posted here Increase PHP.ini file upload limit on Google Cloud Platform Kubernetes WordPress Click-to-Deploy
Editing the wp-config.php file dindt solve the problem or as far I can tell any impact
Editing the .htaccess file (write the lines suggested in the middle of the script) made the wordpress server crash and unusable.
2
Answers
First of all you can find the
php.ini
file being used by your WordPress by hosting a a file namedwhatever.php
in your Webserver’s Document Root folder. Please put inside that file the following contents inside that file:That’s right, you don’t have to close the
?>
short tags at the end of the file.Then, hit that file through your
http://yoursite/whatever.php
address and check the output of wherephp,ini
is set to.You don’t have to use the
whatever.php
name for that file, use something obscure so only you know the name, once done, remove it from the path. I’ve made this example and list it here in this thread as a hypothetical file name, so, if you decide to renamewhatever.php
to something else, adjust your URL’s accordingly when hitting it.If you have not yet configured a domain name for this WordPress, your hostname will be your given Public IP Address.
In that case, you should replace
http://hostname/whatever.php
withhttp://x.x.x.x/whatever.php
, wherex.x.x.x
is your assigned Public IP Address.If your website is using TLS/SSL, you must start with
https://hostname/whatever.php
orhttps://x.x.x.x/whatever.php
, note the extras
letter inhttp
s://
If you think that’s too much of a hassle, then you can ssh into your VM and run the following find command:
You will most likely find the file at the
/etc/php/php.ini
path.Then, edit the file with your preferred code editor. Hint:
vim
ftw!Tyoe:
Then, hit
/
, this will activatevim
‘s powerful search feature.Once that’s done, find the proper entry
upload_max_filesize
hitEnter
.Once you find the entry, hit
I
as ininsert
.Change it to the appropriate value you wish, make sure not to make it so big to avoid security issues later.
As a default, I think it starts with
2M
, but, this template may have it modified for WordPress usage already, not sure.Pick something like
100M
(100 megabytes) for its value, that’s a lot for a single file IMHO, but some templates may need it.Go figure. Adjust to something slightly bigger than your template’s size amount, give it or take.
To save and close, first hit
Escape
then type:wq
, as in Write and Quit!Once done, either
reboot
the machine or run the following command:If using a distro such as CentOS and Apache as the Webserver
If using a distro such as CentOS and Nginx as the Webserver
If using a distro such as Ubuntu/Debian and Apache as the Webserver
If using a distro such as Ubuntu/Debian and Nginx as the Webserver
This will reload the Webserver’s configuration and so does PHP as it is a module for that Webserver.
That should do it.
Hint: You can also verify the PHP setting for
upload_max_filesize
inside of that phpinfo urlhttp://hostname/whatever.php
.Use
Ctrl/Command +F
as the best Friend in such situations! Yay!Also Welcome to StackOverflow and a great choice in choosing Google Cloud!
Full Disclosure: I work for Google Cloud! 🙂
Each PHP .ini file I try to edit says access denied. That is as far as I can get..