Koozali.org: home of the SME Server

Obsolete Releases => SME Server 7.x => Topic started by: spook on November 16, 2006, 09:31:41 AM

Title: Editing php.ini - The proper way.
Post by: spook on November 16, 2006, 09:31:41 AM
I have to add a line to php.ini, but when I do
Code: [Select]
vi /etc/php.ini it says that I should modify the source template instead.

How do I go about that, then?

I need to add
Code: [Select]
upload_tmp_dir = /home/e-smith/files/ibays/Primary/html/tmp
Title: Editing php.ini - The proper way.
Post by: duncan on November 16, 2006, 10:03:26 AM
/etc/e-smith/templates/etc/php.ini

And use pico or nano rather than vi. Easier.
Title: Editing php.ini - The proper way.
Post by: spook on November 16, 2006, 10:52:20 AM
So I just add the line to the template, and all is good?
Title: Editing php.ini - The proper way.
Post by: spook on November 16, 2006, 11:25:23 AM
Hrm... added the line I needed in the template and restarted Apache. No luck. Then I restarted the entire server. No luck either...

When I look at php.ini afterwards, it hasn't changed one bit.  :(

...and I use VI 'cause I like it ;)
Title: Editing php.ini - The proper way.
Post by: Terry on November 16, 2006, 01:40:04 PM
The proper way with other templated config files is to create a custom template fragment, modify, expand templates (writes new config file with included changes), restart service.
Title: Editing php.ini - The proper way.
Post by: hackersoft on November 16, 2006, 01:51:49 PM
I also want to modify some settings in the php.ini file?
Any example available on how to do this?
It would be very much appreciated for beginners in SME like me...
Thanks!
Title: Editing php.ini - The proper way.
Post by: spook on November 16, 2006, 02:02:09 PM
Quote from: "Terry"
The proper way with other templated config files is to create a custom template fragment, modify, expand templates (writes new config file with included changes), restart service.


Sounds like the thing I need to do!

Where do I read the how-to on that?
Title: Editing php.ini - The proper way.
Post by: duncan on November 16, 2006, 02:17:31 PM
Quote from: "spook"


Sounds like the thing I need to do!

Where do I read the how-to on that?


Create the mod in

/etc/e-smith/templates-custom/etc/php.ini

and expand the template

Code: [Select]
/sbin/e-smith/expand-template /etc/php.ini
Title: Re: Editing php.ini - The proper way.
Post by: william_syd on November 16, 2006, 02:51:28 PM
Quote from: "spook"
I have to add a line to php.ini, but when I do
Code: [Select]
vi /etc/php.ini it says that I should modify the source template instead.

How do I go about that, then?

I need to add
Code: [Select]
upload_tmp_dir = /home/e-smith/files/ibays/Primary/html/tmp


upload_tmp_dir is currently set to no value

It does not appear in any templates so I'll assume there's no db property for it.

So, quickly..
Code: [Select]
mkdir -p /etc/e-smith/templates-custom/etc/php.ini
Code: [Select]
cp /etc/e-smith/templates/etc/php.ini/50PathsDirectories /etc/e-smith/templates-custom/etc/php.ini
Code: [Select]
pico -w /etc/e-smith/templates-custom/etc/php.ini/50PathsDirectories
Add what you want at the bottom and save
Code: [Select]
expand-template /etc/php.ini
Code: [Select]
/etc/rc.d/rc7.d/S86httpd-e-smith restart

It's all explained in the developer manual available via the smeserver.org link above.
Title: Editing php.ini - The proper way.
Post by: spook on November 16, 2006, 03:14:33 PM
The line I needed to add was already added to the bottom of that section - So I guess my first attempts at editing it was successful, but after restarting HTTPD it seems as if it doesnt read from the template - The temp upload dir in joomla still shows up as /tmp/. If I manually edit /etc/php.ini, it changes to /home/e-smith/files/ibays/Primary/html/tmp.
Title: Editing php.ini - The proper way.
Post by: william_syd on November 16, 2006, 03:33:36 PM
Quote from: "spook"
The line I needed to add was already added to the bottom of that section - So I guess my first attempts at editing it was successful, but after restarting HTTPD it seems as if it doesnt read from the template - The temp upload dir in joomla still shows up as /tmp/. If I manually edit /etc/php.ini, it changes to /home/e-smith/files/ibays/Primary/html/tmp.


Contents of mine is..
Code: [Select]
include_path = ".:/usr/share/pear-addons:/usr/share/pear"
doc_root =
user_dir =
extension_dir = /usr/lib/php4
enable_dl = On


Nothing about
Code: [Select]
upload_tmp_dir =

Any reason you not installing Joomla from dungog? (http://dungog.net/sme/webapp.php#joomla)
Title: Editing php.ini - The proper way.
Post by: william_syd on November 16, 2006, 03:47:56 PM
Info..

Create a directory
Code: [Select]
mkdir -p /home/e-smith/files/ibays/Primary/html/phptest
In that directory create a file called index.php containing
Code: [Select]
<html>
<head>
<title></title>
</head>


<body bgcolor="#FFFFFF">
<?PHP
if (imagetypes() & IMG_GIF) echo "GIF Support is enabled<br />";
if (imagetypes() & IMG_JPG) echo "JPEG Support is enabled<br />";
if (imagetypes() & IMG_PNG) echo "PNG Support is enabled<br />";
if (imagetypes() & IMG_WBMP) echo "WBMP Support is enabled<br />";
phpinfo();

?>
</body>


</html>


Now view that directory with a browser
http://www.your.server/phptest and it should now show your php setting similar to
https://secure.magicwilly.info/phptest/
Title: Editing php.ini - The proper way.
Post by: spook on November 16, 2006, 05:01:28 PM
I already added the line myself - thats why it showed up in my template. But when I check /etc/php.ini after expanding the template and restarting httpd (and even restarting the entire server) none of my changes are in it. The max. fileupload is still 10mb, and the line I added to the template is nowhere to be found.

It seems like /etc/php.ini is not being rewritten from the template as it should...
Title: Editing php.ini - The proper way.
Post by: william_syd on November 16, 2006, 11:35:40 PM
Quote from: "spook"
I already added the line myself - thats why it showed up in my template. But when I check /etc/php.ini after expanding the template and restarting httpd (and even restarting the entire server) none of my changes are in it. The max. fileupload is still 10mb, and the line I added to the template is nowhere to be found.

It seems like /etc/php.ini is not being rewritten from the template as it should...


Well, what I typed works.

Look at my phptest page again and you will see that upload_tmp_dir = has changed.
Title: Editing php.ini - The proper way.
Post by: william_syd on November 17, 2006, 12:07:21 AM
Some values use the db system

http://forums.contribs.org/index.php?topic=33486.msg142868#msg142868
Title: Re: Editing php.ini - The proper way.
Post by: judgej on November 17, 2006, 02:45:16 AM
Assuming you now know how to do this, I would ask "why"?

What you are doing here seems like it could be dangerous to the security of your server, and at best, is likely to be unnecessary.

I suspect you are using an application that [wrongly] does a direct copy of an uploaded file to another directory? phpBB perhaps? If so, then there are other threads that describe how to deal with this.

No-one is going to stop you doing this, but I would recommend you seriously think it through. You may well be introducing a serious problem as a result of trying to work around a problem that could be solved other ways.

-- Jason
Title: Editing php.ini - The proper way.
Post by: spook on November 17, 2006, 11:15:19 AM
I'll be damned.

You were absolutely correct, I did the phptest (see it at www.internettet.org), and it show all the right values and settings.

But Joomla still insists that /tmp/ is the place for tmp stuff.

The reason I have not installed joomla from Dungog is that I had not heard about the site until yesterday. So I am just running a standard Joomla install.  Which is working fine, except from the /tmp/ stuff.
Title: Editing php.ini - The proper way.
Post by: william_syd on November 17, 2006, 11:43:35 AM
Quote from: "spook"
I'll be damned.

You were absolutely correct, I did the phptest (see it at www.internettet.org), and it show all the right values and settings.

But Joomla still insists that /tmp/ is the place for tmp stuff.

The reason I have not installed joomla from Dungog is that I had not heard about the site until yesterday. So I am just running a standard Joomla install.  Which is working fine, except from the /tmp/ stuff.


Search for php open_basedir for how to use /tmp Its a db command.