php.ini seems to be getting ignored
Posted by: DudeFace (---.bois.qwest.net)
Date: August 18, 2013 03:14PM

I have a php.ini file in the /www folder. In this php.ini file if I change this line:

session.save_path = "/tmp"

to:

session.save_path = "/private"

, surfing the website still ends up saving the sessions in the original "/tmp" folder. However; when I add these two lines of code on every php file that uses sessions:

session_save_path('../private');
ini_set('session.gc_probability', 1);

, it works.

So, why wouldn't the php.ini alteration change the directory that the session is saved in? This alteration would have been a much easier fix than the second method (since I have to add the code to many many files).


Also, I'm using this line in the php.ini file (to make sure certain functions cannot work):

disable_functions = system,exec,register_globals,phpinfo

but when I test it by calling phpinfo() on one of my test pages, it still echos out the php info.

It's as if any changes I'm making to the php.ini file are being ignored...

Any idea what I have to do to have my changes to the php.ini file actually make a difference?

Thank you.

Options: ReplyQuote
Re: php.ini seems to be getting ignored
Posted by: stevenmartin99 (Moderator)
Date: August 18, 2013 03:19PM

are you sure your editing the correct php.ini in the apache/bin folder?

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: php.ini seems to be getting ignored
Posted by: DudeFace (---.bois.qwest.net)
Date: August 18, 2013 03:31PM

I'm assuming the php.ini file you're speaking of is the master php.ini file. But if I have my own php.ini file in the "www" folder, (which I'm assuming is equivalent to the "public_html" folder on a hosted site), wouldn't the file in the "www" folder override the settings in the master?

Thank you

Options: ReplyQuote
Re: php.ini seems to be getting ignored
Posted by: RiggsFolly (---.ppp.as43234.net)
Date: August 18, 2013 03:35PM

No not unless you tell it to.

If you want to edit the php.ini file that is actually being used, use the menu link on
wampmanager -> PHP -> php.ini

Also remember that when you change this you must restart Apache for your changes to take effect

Options: ReplyQuote
Re: php.ini seems to be getting ignored
Posted by: stevenmartin99 (Moderator)
Date: August 18, 2013 03:41PM

no you are correct , a php.ini in the folder will overide the master file but can you ensure the file is called php.ini and not php.ini.txt before we look at it further


you need to turn on file extension showing in windows as its off be default for known file types

Steven Martin
stevenmartin99@gmail.com
stevenmartin99@hotmail.com
PampServer.com - [pampserver.com]

Options: ReplyQuote
Re: php.ini seems to be getting ignored
Posted by: DudeFace (---.bois.qwest.net)
Date: August 18, 2013 03:48PM

I have confirmed that my php.ini file in the www folder is correctly named. It is not a text file. Windows even shows it as type "Configuration settings".

Options: ReplyQuote
Re: php.ini seems to be getting ignored
Posted by: RiggsFolly (---.ppp.as43234.net)
Date: August 18, 2013 05:30PM

According to the manual: [php.net]

Since PHP 5.3.0, PHP includes support for .htaccess-style INI files on a per-directory basis. These files are processed only by the CGI/FastCGI SAPI. This functionality obsoletes the PECL htscanner extension. If you are using Apache, use .htaccess files for the same effect.


Unfortunately WAMP does not use CGI or Fast/CGI modes it runs php as a included module.

This si probably the reason it is ignoring your php.ini in the website folder(s).

Options: ReplyQuote
Re: php.ini seems to be getting ignored
Posted by: DudeFace (---.bois.qwest.net)
Date: August 18, 2013 05:42PM

ok.

In the last few minutes I've replaced the "master" php.ini located at wamp\bin\php\php5.4.16 with my own php.ini file, then restarted WAMPserver. The changes are STILL being ignored. So, I don't know what the heck is going on...

Anyway, if your last response was indicating I'd have to use an .htaccess file instead, to achieve my goals, do you know how to write the script in the .htaccess file? I'm unfamiliar with how to write it.

What I'm trying to achieve:
1: Change where the sessions data is being stored from /tmp to /private
2: Use the open_basedir setting (for security reasons)
3: Disable certain functions, such as system() and exec() and phpinfo()

Thank you

Options: ReplyQuote
Re: php.ini seems to be getting ignored
Posted by: RiggsFolly (---.ppp.as43234.net)
Date: August 18, 2013 06:00PM

What do you consider to be the MASTER php.ini?

If you use the wampmanager menu links it will ensure you are editing the correct file, which is not always obvious to beginners

The php.ini used by Apache is in the c:\wamp\bin\apache\apachex.y.x\bin folder and is called php.ini (use the menus to edit this )

The php.ini used by PHP CLI is in the c:\wamp\bin\php\phpx.y.z\ folder ( have to manually edit this )

Always remember to restart Apache to load the changed php.ini after saving php.ini


PS. WAMP is designed to be a development and test environment and not a LIVE server.



Edited 1 time(s). Last edit at 08/18/2013 06:01PM by RiggsFolly.

Options: ReplyQuote


Sorry, only registered users may post in this forum.