session problems on mamp - session

I have a problem with sessions, my php code works perfectly on easyPhp but not on MAMP.
With easyPhp I have to modify the php.ini file from session.auto_start = 0 to session.auto_start = 1.
What should I do to make it work with MAMP?

For MAMP, the default php.ini setting is session.auto_start = 0. So I'm assuming you wish to modify it to session.auto_start = 1 as you did for easyPHP.
In order to do so, follow these steps:
Start MAMP
File > Edit Template > PHP > [select php.ini file]*
Find the line that says: session.auto_start = 0
Change it to session.auto_start = 1
Save the file
Restart your MAMP server
Once you change any of the MAMP configuration defaults, MAMP will generate an appropriate configuration file in the following subdirectory: ~/Library/Application\ Support/appsolute/MAMP\ PRO/templates/, so you can edit those files directly, instead of going through MAMP.
* The php.ini file you select should match the version you're running through MAMP (selected under server > PHP, in the main window).

Related

Why my custom validation is not working in laravel? [duplicate]

I am getting this error when trying to upload an import on WordPress on my XAMPP local dev environment:
Warning: POST Content-Length of 8978294 bytes exceeds the limit of 8388608 bytes in Unknown on line 0
I changed the upload_max_filesize from 2M to 1000M, but that didn't seem to do anything.
Any ideas?
8388608 bytes is 8M, the default limit in PHP. Update your post_max_size in php.ini to a larger value.
upload_max_filesize sets the max file size that a user can upload while
post_max_size sets the maximum amount of data that can be sent via a POST in a form.
So you can set upload_max_filesize to 1 meg, which will mean that the biggest single file a user can upload is 1 megabyte, but they could upload 5 of them at once if the post_max_size was set to 5.
Changes will take effect after a restart of the server.
Just set these in php.ini:
upload_max_filesize = 1000M;
post_max_size = 1000M;
1. First u will find the php.ini file.
u can find php.ini file from this path. C:\xampp\php or from
xampp folder.
2. Now open php.ini file and change the following:
1. post-max-size (change 8M to 800M).
2. upload-max-filesize (change 2M to 2000M).
3. Now stop the Apache server and MySQL.
4. Now restart Apache server and MySQL.
It worked fine after that.
Enjoy ur working now :)
That's an 8MB post_max_size error.
Set it to a value you're comfortable with.
You will have to change the value of
post-max-size
upload-max-filesize
both of which you will find in php.ini
Restarting your server will help it start working. On a local test server running XAMIP, i had to stop the Apache server and restart it. It worked fine after that.
Already restarted your Webserver?
This will force php to reload the php.ini
Go to C:\xamppp\php. Set these values in php.ini:
upload_max_filesize = 1000M
post_max_size = 0M
Create new text file in your wp-admin directory root and name it info.php.
Open info.php and add this line:
<?php phpinfo(); ?>
Save it.
Go to yourwebsitename(probably localhost)/wp-admin/info.php in any web-browser.
On the 8th line you will see: Configuration File (php.ini) Path, in my case it is C:\Windows, meaning it is located on my C drive.
In the 9th line you will see: Loaded Configuration File, and next to it is written C:\xampp\php.ini
So I found my php.ini page that is associated with my wordpress web-site.
Go to that path, and find php.ini.
Open it, and edit:
Search for post_max_size=8M, and change it to post_max_size=1000M
Search for upload_max_filesize=2M, and change it to upload_max_filesize=1000M
Go back to your Admin page → Media → Add New
On the bottom you will see that 2MB has changed to 1000M.
Once you done this process then you must restart your web server or just restart your computer.
Find php.ini [\xampp\php]
Just set these in php.ini:
upload_max_filesize = 1000M;
post_max_size = 1000M;
Rebot server
Stop Apache and MySQL
Start again Apache and MySQL
Go to
C:\drive\xampp(where xampp installed)
simply find php.ini file then in the file search
post_max_size=XXM
upload_max_size=XXM
Change with this code
post_max_size=100M
upload_max_filesize=100M
Don't forget to restart the xampp
Using wamp do the following and hopefully, it will resolve an issue
Make these changes in PHP Options to correct:
max_execution_time 180
memory_limit 512M or your highest available
post_max_size 32M
upload_max_filesize 64M
You also need the change post-max-size.
From the XAMPP panel, click on the ADMIN button on the Apache site.
Then choose to edit php.ini
And add the missing post_max_size to a value you are comfortable with.
post_max_size = 100M
Go to
C:\ drive
or that drive where xampp is installed
click on xampp
find php and open it , there you find php.ini folder
open php.ini file with notepad and find upload_max_filesize and post_max_size in both "up and down find option",change both values to 1000M
I have fixed same issue by changing below parameters to expected value in /etc/php/7.2/apache2/php.ini file
upload_max_filesize = 8M;
post_max_size = 8M;
upload_max_filesize = 8M;
post_max_size = 8M;
Imagine you already changed above values. But what happen when user try to upload large files greater than 8M ?
This is what happen, PHP shows this warning!
Warning: POST Content-Length of x bytes exceeds the limit of y bytes in Unknown on line 0
you can avoid it by adding
ob_get_contents();
ob_end_clean();
You have 2 options for this error:
The file you are uploading is too big, which you need to use smaller file.
Increase the upload size in php.ini to
upload_max_filesize = 9M; post_max_size = 9M;
Go to browser and search for php.ini and then open it, and change these two values:
post_max_size= 1000000000000M
upload_max_filesize= 10000000000000M
If you open the php.ini file using notepad , you can search for these two values by clicking:
cmd + f
You might not be uploading the right zip file. In my case, as a newbie to wordpress(I used to do hardcoding), I installed the zipped file that contained another zip file which is the actual theme neede to be upload. So what what need to do in this case is to unzip the file and locate the "theme_name.zip" inside.
If changing the post_max_size settings from XAMPP folders. It did not work for you try this.
From XAMPP control panel, click config then PHP (php.ini) and edit post_max_size and upload_max_filesize to a higher number in this file instead. Stop Apache server. Start Apache server. This worked for me.
If your objective is to import a theme into your Wordpress then you can manually copy paste your theme into your wp-content->themes folder and extract it of course. I just encountered this and couldn't locate the php.ini file for WAMP.
I have solved my php7 issues on centos 7 by updating /etc/php.ini with these settings:
post_max_size = 500M
upload_max_filesize = 500M
As Optimaz ID pointed out, the code below helped me hide the PHP error message in a case where the user uploads a file larger than the upload_max_filesize and post_max_size set in php.ini (which is almost impossible when a large value is set).
ob_get_contents();
ob_end_clean();
for anyone running PHPMyAdmin inside of docker.
Set the UPLOAD_LIMIT value in the env
from the docs https://github.com/phpmyadmin/docker#environment-variables-summary
UPLOAD_LIMIT - if set, this option will override the default value
for apache and php-fpm (format as [0-9+](K,M,G) default value is
2048K, this will change upload_max_filesize and post_max_size
values)
docker-compose.yml example:
phpmyadmin:
image: phpmyadmin/phpmyadmin
environment:
- UPLOAD_LIMIT=300M
normal docker run:
sudo docker run .... -e UPLOAD_LIMIT=300M
For both of these options you have to rebuild the container

I am getting 404 error for css and js files after I installed magento

I installed magento 2.4.2 on bluehost vps hosting, but I am getting the website as shown in figure 1 I tried every solution I found online but non of them worked for me.
Solutions I tried:
1- changing the permission for pub/static dir.
2- In app/etc/di.xml, find the virtualType name=”developerMaterialization” section and its item called name=”view_preprocessed”. I changed Symlink with Copy in Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink.
3- php bin/magento setup:static-content:deploy -f command
4- RewriteEngine On, in /pub/static/.htaccess file
5- set sign static files to No (dev/static/sign to 0)
I wish someone can help
Hi #Silverwolf96 and welcome on StackOverflow.
There are few things you can try/check.
1.) Check in the page source if the URLs to your files are correct. If not set correctly, set them manually as described in step 2.
2.) Go to Store > Configuration > General > Web and set under Base URLs & Base URLs (Secure) your URLs for static files - you can set this URL manually and it needs to be set as http://www.example.com/static/
3.) You can try to remove pub/static/frontend on the server
4.) Check what happens if you select Magento Luma as the default theme

info.php shows log_errors is Off but it is set to be On in the php.ini of Loaded Configuration File

PHP info page shows that log_errors is set Off even tho I set it On
in info.php page shows:
Loaded Configuration File -> /etc/php/7.0/apache2/php.ini
Scan this dir for additional .ini files -> /etc/php/7.0/apache2/conf.d
top portion of altered php.ini file:
[PHP]
;;;;;;;;;;;;;;;;;;;
; About php.ini ;
;;;;;;;;;;;;;;;;;;;
; PHP's initialization file, generally called php.ini, is responsible for
; configuring many of the aspects of PHP's behavior.
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
display_errors = On
log_errors = On
error_log = /var/log/php-errors.log
I have tracked the rest of php.ini file and found other log_error reference which I have also set On
log_errors = On
I am not sure if I should use ini_set('display_errors', 1); format in .ini files, I have found answers about this and used everything to test if anything worked but still.
So what's wrong with config?
Note: yes, I have restarted apache2.
Using up to date Ubuntu Server x64 16.04 running PHP Version 7.0.13-0ubuntu0.16.04.1
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
won't work in ini file.
to enable error reporting write following line in your ini file
error_reporting = E_ALL
for more info refer here

How to turn on magento error messages?

I have installed Magento Community edition and tried creating my first simple hello world module. After a few hours I finally got it working.
My issues were I had used incorrect casing in some of the XML tags.
While trying to get it to work I tried to load the page a not found message was displayed, but no error.
I have switched errors on in the admin control panel System > Configuration > Developer > Log Settings and wrote a line which I know should have thrown an error but I just got a blank screen
How do I get errors to display in Magento?
Is it considered an error when I use incorrect casing in an xml file or is that an issue where I would not receive an error message? And if that is the case how would I quickly find the file that is causing the issue (obviously not a problem at the moment, but I can imagine as the module become functional it will be hard to find a single casing issue that is causing the problem)
For enable error reporting
In Index page change the following:
error_reporting(E_ALL | E_STRICT);
to
error_reporting(E_ALL);
Set $_SERVER['MAGE_IS_DEVELOPER_MODE'] = true
and uncomment this line
#ini_set('display_errors', 1);
In Errors folder rename local.xml.sample to local.xml.
hope this help.
to complete the pankaj post,
this work for me
index.php
ini_set('display_errors', 1);
error_reporting(E_ALL);
$_SERVER['MAGE_IS_DEVELOPER_MODE'] = true;
Here are the steps that you should do in order to set Magento to display errors on the browser:
System > Cache Management > Disable All
System > Configuration > Advanced > Developer > Log Settings > Enabled => Yes
System > Configuration > Web > Search Engine Optimization > Use Wbe Server Rewrites => Yes
System > Index Management > Reindex All
Open .htaccess and set: SetEnv MAGE_IS_DEVELOPER_MODE "true" at the end of the file
Open .htaccess and set: php_value display_errors On somewhere within
Rename or copy /errors/local.xml.sample to /errors/local.xml
Modifying this code in magneto directory index.php:
Search for error_reporting(E_ALL | E_STRICT);
Replace with
error_reporting(E_ALL);
$_SERVER['MAGE_IS_DEVELOPER_MODE'] = true;
OR
Uncomment it by removing the # sign from
#ini_set('display_errors', 1);
Refereed Link:
http://www.templatemonster.com/help/magento-how-to-display-error-messages.html

moodle "Can not initialise PHP session, please verify that your browser accepts cookies."

I'm trying to install MOODLE locally
and i face this problem
Can not initialize PHP session, please verify that your browser accepts cookies.
I'm trying to enable cookie (I'm using chrome)
following these steps
https://support.google.com/accounts/bin/answer.py?hl=en&answer=61416
and I also tried to config php.ini
http://support.qualityunit.com/021373-How-To-Enable-Session-Support-for-PHP
but still can't solve it
anyone can help me?
php configuration <br/>
session
Session Support enabled
Registered save handlers files user
Registered serializer handlers php php_binary wddx
Directive Local Value Master Value
session.auto_start Off Off
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_httponly Off Off
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 1000 1000
session.gc_maxlifetime 1440 1440
session.gc_probability 1 1
session.hash_bits_per_character 5 5
session.hash_function 0 0
session.name PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path D:\EasyPHP-12.1/tmp D:\EasyPHP-12.1/tmp
session.serialize_handler php php
session.upload_progress.cleanup On On
session.upload_progress.enabled On On
session.upload_progress.freq 1% 1%
session.upload_progress.min_freq 1 1
session.upload_progress.name PHP_SESSION_UPLOAD_PROGRESS PHP_SESSION_UPLOAD_PROGRESS <br/>
session.upload_progress.prefix upload_progress_ upload_progress_ <br/>
session.use_cookies On On <br/>
session.use_only_cookies On On <br/>
session.use_trans_sid 0 0 <br/>
Usually this is a php config problem where php can't write to the session folder.
The exact path and user vary by operating system but I'll attempt to summarize.
First we need to see if sessions are the problem but we need to know which config file php using and which path its saving sessions to.
To do that:
Make a new file in your moodle install folder called info.php,
add <?php phpinfo(); ?>
and save.
Send your browser to that page on your
webserver.
This will show you a couple of things:
"session.save_path" is where php is trying to save your sessions files.
"APACHE_RUN_USER" is the user apache is running as.
"Loaded Configuration File" will show you which file php is reading these
settings from.
If your session.save_path is set, check the permissions of that folder. They should be owned by the web server user. Once you've fixed that, reload the moodle screen.
If your session.save_path is not set, set it to "/tmp/" for now.
This is a location which is always writable but isn't very secure.
Restart your web server and reload the moodle screen.
Hy, I faced the same issue. I just clear the site data from the browser and work.

Resources