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

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

Related

Installing Moodle: It is requesting 5000 under Max_input_vars

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/

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

jquery-file-upload file arrives as random numbers

So I have the jquery file upload script running on my webserver, with a target-url pointing to a local mac server with apache/php, and when I go to upload a file the script shows the progress bar and it completes, and it arrives to the correct directory and everything on the mac, but the file is an assortment of numbers like:
1390865006
or
1390865033
and it should be noted that those files are about the correct size, but even if I add .jpg to the end of the file name they won't open as images.
Am I missing some crucial something somewhere? I hope it's not my mac being too old, I didn't see any requirements for php version in jquery file upload, but I am running 5.2.8
Thanks
* EDIT *
This was resolved by upgrading PHP to 5.5.8
This was resolved by upgrading PHP to 5.5.8

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;

Zf Tool cannot find Zend Framework

Just started working with the Zend Framework Zf Tool and I've already come across a problem I've spent hours trying to figure out.
For some reason when I run the Zf show version command I get a ZF ERROR indicating it cant find the Zend Framework a to add it to my php.ini include_directory.
Here is my setup. I'm currently have WAMP installed on my local machine.
c:\wamp
I copied the zf.bat and zf.php files into the servers php directory. The path to the php directory has been added to the path environment variable. I'm pretty sure it works because I run the zf show version command in the console and get a ZF ERROR.
I keep my copy of the Zend Framework inside
c:\wamp\includes
So I added this to the php.ini include_path. include_path = ".;c:\wamp\includes"
I checked that this setting was set correctly by checking phpinfo() function. Which shows
include_path .;c:\wamp\includes .;c:\wamp\includes
So I think I have everything setup correctly. I can't work out what I'm missing.
I also tried setting the ZEND_TOOL_INCLUDE_PATH with no success.
Any help would be appreciated. PS I did check other posts here but none of the suggested
I have worked it out! Finally. The way I have my local wamp setup there is 2 php.ini files I have to edit.
The one that made the different is the php.ini inside the Apache2 directory.
Thanks everyone for their help. I appreciate it.
Well im not sure how you downloaded installed the framework but my guess is that you dont have enough of you include path based on the way Zend release packages are constructed. The Zend folder contained in the Zend Framework installation needs its parent folder to be on the include path so typically you would add something like:
c:\wamp\includes\ZF_BASE_DIR\library
This is because the zf package structure looks like:
ZendFramework-VERSION/
README.txt
INSTALL.txt
LICENSE.txt
bin/
library/
If you extracted ZF from the archive you will get a Zend-some_version folder, but the actual ZF is in
"include_path\Zend-some_version\library\Zend", so your include path should point include_path\Zend-some_version\library\
Just to add to what Tjorriemorrie said and to explain in detail how I got my installation on win 7 to work as simply as possible:
Download your preferred Zend package from "http://framework.zend.com/downloads/latest" to "C:\wamp\www\"
unzip your zip file so that you have the extracted Zend folder (with version name) under "C:\wamp\www\".
Rename your folder by removing the version so that you end up with "C:\wamp\www\ZendFramework"
Run a simple php file with phpinfo() in your browser. Note the entries for: "_SERVER["PATH"]" under PHP Variables
"Path" under Environment
"Loaded Configuration File" at the top
"include_path" under Core and
"extension_dir" under Core as well.
"_SERVER["PATH"]" and "Path" must be identical (no brainer)
There should be only one listing for your apache server and that should be the listing under "Loaded Configuration File" but without the "php.ini". So, if your "Loaded Configuration File" is "C:\wamp\bin\apache\apache2.2.22\bin\php.ini" you must have "C:\wamp\bin\apache\apache2.2.22\bin" in your path and that must be the ONLY reference to an apache server. If you have multiple references to apache servers Windows may pick the wrong one depending on your PATH order and use the wrong php.ini file.
Your "extension_dir" will tell you the version and location of php you are using. It is common to have different php folders lying around such as "C:\php", "C:\wamp\bin\php\php5.4.3", "C:\wamp\bin\php\php5.3....", etc. The extension directory will tell you which one of these php folders ZF will "reference" when it is looking for its library. For example, if your extension directory says "c:/wamp/bin/php/php5.4.3/ext/", you want to focus on "c:/wamp/bin/php/php5.4.3"
Go back to your PATH and a) add the string for this php version and b) remove all the other references to the other php folders
Now that you know your running and primary php and apache folders, shutdown (do not restart), shut down your computer and boot back up (restart does not always let the PATH completely reset.
Go to BOTH php.ini files at a) "C:\wamp\bin\apache\apache2.x.y\bin" and "C:\wamp\bin\php\php5.4.3" and find the include_path variable for Windows
Replace the default line, which looks like:
;include_path = ".;c:\php\includes;"
with
include_path = ".;c:\php\includes;C:\wamp\www\ZendFramework\library"
ON BOTH FILES just as Tjorriemorrie notes.
Restart All Services by clicking the wamp icon and selecting said option
At this point my zf tool was working. But, just to be safe, shut down and bootup
Smile and grab a beer!