Installing Moodle: It is requesting 5000 under Max_input_vars - mamp

I cannot find the php.ini file or .htaccess file where I'm meant to change the max_input_vars to 5000 in my moodle website folder. I'm using mamp and myphpadmin
Moodle explains "To change max_input_vars you can either set it in php.ini or modify it in runtime, for example for Apache you can create .htaccess file: php_value max_input_vars 5000"
I searched in finder.

Create a test php file in the root of the Moodle folder with
<?php
phpinfo();
Then open it from the browser, not the command line (the command line and web server might use different versions of php)
eg: yourmoodlesite/test.php
This will display the location of the php.ini file that is being used, eg:
Loaded Configuration File /etc/php/7.4/apache2/php.ini
I haven't used MAMP, but the documentation says the php file can also be edited via the menu in MAMP PRO
File > Open Template > PHP > [PHP version] -> php.ini
It also says the location is
/Library/Application Support/appsolute/MAMP PRO/conf
https://documentation.mamp.info/en/MAMP-PRO-Mac/Menu/

Related

Where i can find Php.ini file in eclipse

I am trying to upload an image in my PHP program using eclipse, but here i am not able to find php.ini file.
please help for this
thank you
Here is how you can find your php.ini file regardless of what operating system you are using!
First make a new php file called info.php or some other file name, and deploy it to the document folder, with the following code in it:
<?php
echo phpinfo();
?>
Then access that new php page through the web browser (if the server is working right, the URL is something like http://localhost/php.info maybe).
Then it shows a ton of info including the location of the php.info file.
For me it says "Configuration File (php.ini) Path /etc/php5/fpm" since I am using linux.
Also I think in Windows you can use a file find operation to locate your configuration file.
open up your terminal / command line and enter in the following to find your php.ini file
php -i | grep /php.ini

Changed upload_max_filesize in php.ini but phpinfo doesn't show the change

Basically phpinfo says upload_max_filesize is 2M, but I changed it in the php.ini file to 8M. I am using MAMP, so I restarted MAMP and phpinfo still says 2M. I checked the path to the php.ini file that phpinfo shows and it matched up exactly. See the YouTube video of me documenting all of this.
You should change the file in /Applications/MAMP/bin/php/php5.4.10/conf/php.ini
After you should reset MAMP. I also changed all php.ini before, and phpinfo() doesn't had been change, but I don't sure if it is need to works, so if only changing the file in the path above, try change the others also.
I hope that help you.
On MAC os make sure you are at the right path:
/Applications/MAMP/bin/php/phpx.x.x/conf/php.ini
I see a lot of people had trouble with this since there is also another conf directory
To be sure, write a file with this PHP content:
<?php
phpInfo();
?>
and save it in your main MAMP document root (as any other web page) with name info.php
Open that file as a web URL in your browser as any other MAMP web page, as an example: http://127.0.0.1:8888/info.php
Search for the string: php.ini in that page.
You will find a line like this:
Configuration File (php.ini) Path /Applications/MAMP/bin/php/php7.2.8/conf
That line will show you the correct path for the ini file PHP is using in that moment. It depends on the PHP version you are using.
Delete (or rename with an unguessable name) the info.php file, after (avoid giving all this info to the world).
In httpd.conf file the PhpIniDir had the wrong path. It was off by one directory. That was the fix!
You can update PHP configurations using below:
File(menu) -> Open template -> PHP -> {select PHP version that you want update}
Source: http://blog-en.mamp.info/2009/09/increase-php-memory-limit-with-mamp-pro.html
MAMP PRO php config file is loaded from other path.
I found it after replace all php infos from mamp/bin/php/ directory without results.
/Applications/MAMP PRO/MAMP PRO.app/Contents/Resources/php(VERSION).ini
I have the same problem with MAMP (non pro), MAM is stopped
the current php version I am using is php7.2.20, I have changed everywhere in
/Applications/MAMP/bin/php/php7.2.20 and /Applications/MAMP/conf/php7.2.20
post_max_size = 128M
upload_max_filesize = 128M
I restart MAMP and I get php7.2.20
post_max_size = 8M
upload_max_filesize = 32M

Settings up xdebug on MAMP PRO

I am trying to set up xdebug on mamp pro with no success. I searched all over the internet, nothing helped me.
First I have tried just to uncomment the following line in php.ini:
zend_extension="/Applications/MAMP/bin/php/php5.4.4/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
Next, I've tried the wizard:
http://xdebug.org/wizard.php
Next, I've tried adding these lines to php.ini:
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
Nothing helps. I can't see xdebug in my phpinfo.
MAMP PRO Version: 2.1.1
PHP Version: PHP 5.4.4
Thanks!
Since release of MAMP 2.01 XDebug is already included.
Solved. Here's the tutorial that helped me:
Start MAMP
Edit php.ini template file through MAMP to enable the extension. Edit the template file via File -> Edit Template -> PHP -> PHP php.ini
Edit bottom of php.ini template file so that it ends up looking like if you want profile output
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = "/tmp"
; DONT REMOVE: MAMP PRO php5.3.6.ini template compatibility version: 1
If you don’t want profile output and just want xdebug running then use
[xdebug]
zend_extension="/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
xdebug.profiler_enable = 0
xdebug.profiler_output_dir = "/tmp"
; DONT REMOVE: MAMP PRO php5.3.6.ini template compatibility version: 1
Now when you have errors, if they are sent to standard out, you will see something like this
My php.ini file:
Save edited template and close edit window
Restart MAMP
Open MAMP’s WebStart page and navigate to PHPInfo tab. Check to make sure that Xdebug is running. Doing a search in the browser window for “Xdebug” makes this easy.
If you used the same settings that I have above, when you run PHP code, Xdebug will put the cachegrind.out files in your ‘/tmp’ directory. Open your ‘/temp’ directory and run one of your PHP files to make sure it is working correctly. You can open the ‘/tmp’ directory in finder by opening the terminal and running
open /tmp
Now you can use any app that understands those cachegrind.out files to view the profile data. Apps like KCacheGrind (Linux/Windows, KDE), WinCacheGrind (Windows), xdebugtoolkit, and Webgrind.  I went the simple route and used webgrind. Webgrind is a simple web based application that you can run locally on MAMP and it will look for the cachegrind.out files automatically with just one click. Continue for steps on setting up with webgrind.
Download Webgrind
Setup Webgrind host on MAMP to run Webgrind
Visit webgrind url setup on your local MAMP installation. Mine was simply webgrind/
If you already have cachegrind output files you should be able to select the file in the “Auto (newest)” dropdown or leave it select at Auto and click update which will reveal the profile data
Throw a celebratory fist pump
I had trouble with setting up MAMP Pro and nginx myself and the above answer did not work for me.
The problem was that the default port setting is 9000, which in my case I have that port already in use so I looked in my nginx conf at this line:
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
then go to the file located when fastcgi_pass is set to, and in there you will find the correct port number. In my case it was in Applications/MAMP/Library/logs/fastcgi and the filename is dependent on your host's php version.
Then open that file, and set whatever PID is in there to xdebug.remote_port in php.ini, for me it was 13267.
It may be worthwhile to mention my MAMP config for PHP is set to CGI mode, not modules.
EDIT:
I just realized that the port number dynamically changes way too much. So I set a hardcoded value for fastcgi pass in my nginx template for MAMP like so:
fastcgi_pass 127.0.0.1:9072;
# comment out the regular setting just in case.
# fastcgi_pass unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock;

Where is the web server root directory in WAMP?

Also is the web server root directory the place where you put your site files and later acces them with localhost/file_name in the browser?
If you installed WAMP to c:\wamp then I believe your webserver root directory would be c:\wamp\www, however this might vary depending on version.
Yes, this is where you would put your site files to access them through a browser.
In WAMP the files are served by the Apache component (the A in WAMP).
In Apache, by default the files served are located in the subdirectory htdocs of the installation directory. But this can be changed, and is actually changed when WAMP installs Apache.
The location from where the files are served is named the DocumentRoot, and is defined using a variable in Apache configuration file. The default value is the subdirectory htdocs relative to what is named the ServerRoot directory.
By default the ServerRoot is the installation directory of Apache. However this can also be redefined into the configuration file, or using the -d option of the command httpd which is used to launch Apache. The value in the configuration file overrides the -d option.
The configuration file is by default conf/httpd.conf relative to ServerRoot. But this can be changed using the -f option of command httpd.
When WAMP installs itself, it modify the default configuration file with DocumentRoot c:/wamp/www/. The files to be served need to be located here and not in the htdocs default directory.
You may change this location set by WAMP, either by modifying DocumentRoot in the default configuration file, or by using one of the two command line options -f or -d which point explicitly or implicity to a new configuration file which may hold a different value for DocumentRoot (in that case the new file needs to contain this definition, but also the rest of the configuration found in the default configuration file).
Everything suggested by user "mins" is correct, and excellent information.
WAMP 2.5 provides a default Server Configuration display when you enter localhost into your browser. This maps to c:\wamp\www, as described in previous posts. Creating subdirectories under www will cause Projects to appear on this display. A click and you're in your project.
I have various projects under different directory structures, sometimes on shared drives which makes this centralized location of files inconvenient. Luckily, there is a second feature of WAMP 2.5, an Alias, which makes specifying the location of one (or more) disparate web directories quite easy. No editing of configuration files. Using the WAMP menu, choose Apache > Alias directories > Add an Alias.
WAMP has evolved nicely to provide support for a variety of developer preferences.
If you use Bitnami installer for wampstack, go to:
c:/Bitnami/wampstack-5.6.24-0/apache/conf (of course your version number may be different)
Open the file:
httpd.conf in a text editor like Visual Studio code or Notepad ++
Do a search for "DocumentRoot". See image.
You will be able to change the directory in this file.
To check what is your root directory go to httpd.conf file of apache and search for "DocumentRoot".The location following it is your root directory
this is the path to the web root directory c:\wamp\www
you can create different projects by adding different folders to this directory and call them like:
localhost/project1 from browser
this will run the index.html or index.php, lying inside project1
Here's how I get there using Version 3.0.6 on Windows

Installing Zend framework with WAMP server

I'm trying to install Zend framework on a WAMP server but it is not working properly.
I downloaded the Zend framework and created the folder in C:\wamp\library\Zend, and then in php.inc I have something like this:
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes:C:\wamp\library"
Now when I try to run the sample blogger.php it is giving me the following error:
Warning: require_once(Zend/Loader.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\PHPSample\Blogger.php on line 37
Fatal error: require_once() [function.require]: Failed opening required 'Zend/Loader.php' (include_path='.;C:\php5\pear') in C:\wamp\www\PHPSample\Blogger.php on line 37
Can anyone help me please?
On Windows your php.ini should have a section like this:
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
; UNIX: "/path1:/path2"
; Windows: "\path1;\path2"
The key is to a) remove the semi-colon at the beginning of the line, and b) add what you need to the path. NOTE: on Windows, paths must be separated by semi-colons, whereas on UNIX they are separated by full colons; Also, Dot means "current directory", so only include it if you want to.
Make sure it looks like this:
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;
include_path = ".;c:\php\includes;c:\wamp\library"
Zend Installation:- Download Zend Framework
Go to Wamp/bin/php/
Create a folder Namely:- Zend_Framework
Copy All the Files and Folder of Downloaded Zend Framework.
Go to php.ini and find include_path
Here you find:- include_path="c:\php\includes"
and replace the text between "" from your directory C:\wamp\bin\php\zend_framework\library
and Save File.
Now Go to Computer Property and Advanced System Setting and Advanced and Environment Variable and
select path from system variables and click on Edit and add ; and paste your directory path hare
C:\wamp\bin\php\zend_framework\bin
Open Command Prompt and go to the www directory inside wamp and then type zf create project Zendy
Now go to httpd.conf file and type there <virtualHost></virtualHost> Tags.
<virtualHost 127.0.0.1>
DocumentRoot "C:\www\Zendy\public"
ServerName Zendy
<Directory "C:\www\Zendy\public">
AllowOverride AuthConfig FileInfo Indexes Limit Options
order Deny,Allow
Allow from all
</Directory>
</virtualHost>
Save and Quit and go to windows -> System32 -> drivers-> etc-> hosts and Add here your project
127.0.0.1 localhost Zendy
Save and Quit and Restart Apache
Also set rewrite module via removing ; from php.ini file
i had made this cast explaining how to setup Many ZF Application with Wamp full functional
please check it out and let me know if you had any problem so i can help :
Getting Started with the Zend Framework and WAMP Server
that should work if:
you unpacked contents of the library folder in archive that contains Zend framework in
C:\wamp\library folder. othervise you need to do that ( put the contents of the library folder in archive in path you specified in php.ini