Where is the /etc/nginx folder? - laravel

I'm getting a 413 Request Entity Too Large error when I try to upload a large image (~1MB) to my Laravel api. The solution everyone gives is to modify the /etc/nginx/nginx.conf file, but I canĀ“t seem to be able to find that file. Where is it exactly located? I'm using Windows 10 and Laravel 6.8.

There is no /etc/nginx/ directory on windows because this is a path in Linux operating system, in windows you either have installed XAMP or WAMP for both of them you need to increase upload_max_filesize and post_max_size in your php.ini file, follow this Article to change php.ini for XAMP and it's very similar to WAMP

"/etc/nginx" is for linux. In Windows maybe you are using Xampp (which uses Apache instead Nginx). You may not even be using Apache because you probably run the application with php artisan serve. I recommend you check php settings in for c:\xampp\php\php.ini (edit upload_max_filesize and post_max_size directives)
More info:
https://www.keycdn.com/support/413-request-entity-too-large

Related

Laravel, Linux 2, Centos PostTooLargeException

I have modified the php.ini to increase post_max_size, upload_max_filesize, memory_limit after using php -i | grep php.ini which returns the file location /etc/php.ini
After changing the settings the Apache server is restarted using sudo systemctl restart httpd. However, the error PostTooLargeException persists.
Is there a way to force an error message that will show why the error is persisting?
I have also seen some people saying to edit the .htaccess however my project shows 6 .htaccess files and I am not sure which one would need to be edited
No, there isn't a way to force an error explaining what you want.
To debug it, you should create a php file which runs phpinfo() on your server:
<?php
phpinfo()
There you can check your post_max_size and upload_max_filesize directives are correct.

Can Apache Configuration File (httpd.conf) Be Located Elsewhere?

I have been using Apache on Windows (+PHP +MySQL) for a long time now. Lately, I decided to have the configuration files of Apache, PHP and MySQL in one directory, outside of the installation folders of any of them.
With PHP it works by setting PHPIniDir in Apache's httpd.conf
With MySQL it works by setting the --defaults-file=<path/to/my.ini> option while installing on the command line as a Windows service.
With Apache itself, I haven't been able to find a way. Is it possible to choose an arbitrary location or name for the httpd.conf file? And how?
Thank you.
you could use "..-f httpd.conf" on startup. see http://httpd.apache.org/docs/current/de/invoking.html
Regards

WAMP server 2.4 installation of joomla 2.5.14 stuck on step 4 loading image

I saw similar questions but any of them has not correct answer. The installation of Joomla on localhost does not proceed after step 4. Database Configuration.
WAMPSERVER version 2.4
Apache 2.4.4
PHP 5.4.12
MySQL 5.6.12
Joomla_2.5.14-Stable-Full_Package
for this i tried
left click wampmanager -> PHP -> php.ini
This will open notepad on the correct php.ini file, look for this directive
max_execution_time = 60
Change it to something larger like
max_execution_time = 240
But i did n't get any response still facing installation issue
i had unsuccessfullly tried to intstall joomla 2.5.17 on wamp 2.4. installation would get stuck in the database configuration. i changed the php.ini max execution time to 240 and the installation completed successfully (read about that in the previous answer posted). but be sure to restart wamp server after editing the php.ini file. regards for the help.

Where does MAMP keep its php.ini?

I have recently got a mac an am not used to developing on a mac at all.
I have MAMP Pro 1.9.6.1. I did a locate on php.ini and got this:
$ locate php.ini
/Applications/MAMP/conf/php5.2/php.ini
/Applications/MAMP/conf/php5.3/php.ini
/Library/Application Support/appsolute/MAMP PRO/conf/php.ini
/private/etc/php.ini.default
I changed the name of all of them. Restarted MAMP. It loaded without a hitch (I know odd right?). I am using PHP version 5.2.
All of these files are now different names (done one by one for process of elimination).
So I figure restart the mac. Same, MAMP loaded no problems, even though all of the php.ini files had been move. On Lamp this that wouldn't even load. But either there is another php.ini file I'm missing (quite possible I don't know how to updatedb), MAMP is really intelligent and just pulls in all of them (less likely) or it doesn't use one.
Note: If this doesn't help, check below for Ricardo Martins' answer.
Create a PHP script with <?php phpinfo() ?> in it, run that from your browser, and look for the value Loaded Configuration File. This tells you which php.ini file PHP is using in the context of the web server.
I'm not sure if in MAMP (non-PRO) is the same, but MAMP overrides the modified php.ini everytime it starts.
In my case, I needed to use the MAMP menu to change my php.ini file (File -> Edit Template -> PHP -> PHP 5.xx -> php.ini).
To be clearer (as i read this thread but didn't SEE the solution, also if it was here!), I have the same problem and found the cause: I were modifying the wrong php.ini!
Yes, there are 2 php.ini files in MAMP:
Applications/MAMP/conf/php5.5.10/php.ini
Applications/MAMP/bin/php/php5.5.10/conf/php.ini
The right php.ini file is the second: Applications/MAMP/bin/php/php5.5.10/conf/php.ini
To prove this, create a .php file (call it as you like, for example "info.php") and put into it a simple phpinfo()
<?php
echo phpinfo();
Open it in your browser and search for "Loaded Configuration File": mine is "/Applications/MAMP/bin/php/php5.5.10/conf/php.ini"
The error was here; i edited Applications/MAMP/conf/php5.5.10/php.ini but this is the wrong file to modify! Infact, the right php.ini file is the one in the bin directory.
Take care of this so small difference that caused me literally 1 and a half hours of headaches!
The file you have to edit is in MAMP Pro and uses the php.ini file everytime it starts up.
Start MAMP PRO
Edit File > Edit Templates > PHP 5.3.2 php.ini
Restart MAMP Pro
Your changes should stick.
I don't know if you ever found an answer to this but I DIDN'T need MAMP PRO to do this. Simply goto the correct path by following what others have said. It's something like...
MAMP-> bin-> php-> php(your php version)-> conf-> php.ini
The key here is where you're editing the file. I was making the mistake of editing the commented part of the ini file. You actually have to scroll down to LINE #472 where it says "display_errors = Off and change it to On. Hope this helps any
Just run the following command from your terminal, it will show you your Loaded Configuration File easiest way I have ever found.
php --ini
Change /Applications/MAMP/conf/php5.2/php.ini if you are using 5.2 version of php. If you are using the 5.3 php version, edit the /Applications/MAMP/conf/php5.3/php.ini.
If you are using OSX Lion or OSX Mountain Lion, I recommend you using the default installation of apache and php.
Greets!
After running the MAMP server, you have php info link in toolbar
Once click, You will get all information about php
Probably the fastest way to access the PHP.ini for the currently loaded version of PHP in MAMP PRO (v.4.2.1):
Open MAMP Pro
Click on "PHP" under the "Languages" section on the sidebar
Tap on the arrow button right next to the drop-down that lets you select the "Default Version" of PHP.
It depends on which version of PHP your MAMP is using. You can find it out on: /Applications/MAMP/conf/apache/httpd.conf looking for the configured php5_module.
After that, as someone said before, you have to go to the bin folder. There you'll find a conf folder with a php.ini inside.
example: /Applications/MAMP/bin/php/php5.4.10/conf
Leo
After going through all the solutions here, the easiest way to find the loaded php.ini file is to go into phpinfo on the loaded MAMP webpage, which will show you the loaded php.ini file.
This will also confirm if the parameters you change, like max_file_size, have updated correctly.
On my Mac, running MAMP I have a few locations that would be the likely php.ini, so I edited the memory_limit to different values in the 2 suspected files, to test which one effected the actual MAMP PHP INFO page details.
By doing that I was able to determine that this was the correct php.ini:
/Applications/MAMP/bin/php/php7.2.10/conf/php.ini
I only have the non-pro version of MAMP but just because it loads it doesn't mean the PHP file is being found/without errors.
I renamed my php.ini files and MAMP still started but Apache returned several errors.
What are you trying to change in your php.ini file?
I have checked all answers and of course I have used phpinfo() to check the exact location of php.ini. I don't see a File option in the menu bar on my mac. I changed both php.ini and php.ini.temp files in that folder. No vail.
Until I realized that I forgot to uncomment the modified always_populate_raw_post_data line.
I was struggling with this too. My changes weren't being reflected in phpInfo. It wasn't until I stopped my servers and then restarted them again that my changes actually took effect.

500 error when installing symfony2

I'm trying to install and configure Symfony2 on my server.
My website is on a shared hosting plateform therefore have limited access to root level, apache & php.ini files...
I downloaded then extracted symfony2 files on my dev environment:
www/
dev/
symfony/
app/
bin/
web/
...
When I navigate to http://dev.mydomain.com/symfony/web/config.php I get some recommendations:
Install and enable a PHP accelerator like APC (highly recommended).
Upgrade your intl extension with a newer ICU version (4+).
Set short_open_tag to off in php.ini*.
Set magic_quotes_gpc to off in php.ini*.
Being on a shared hosting plateform I'm not allowed to modify/download the necessary files to fix those recommendations (which I believe shouldn't block the install).
I follow the link "Bypass configuration and go to the Welcome page" which sends me to http://dev.mydomain.com/symfony/web/app_dev.php/
The server throws a 500 Internal Server Error.
Any advice on how to fix that issue would be very much appreciated.
Thanks,
John
When it happened to me I forgot to tell my FTP client to transfer also invisible file (.htaccess) OR permissions on /web folder are not correct

Resources