Koozali.org: home of the SME Server

Editing php.ini - The proper way.

spook

Editing php.ini - The proper way.
« 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

duncan

Editing php.ini - The proper way.
« Reply #1 on: November 16, 2006, 10:03:26 AM »
/etc/e-smith/templates/etc/php.ini

And use pico or nano rather than vi. Easier.

spook

Editing php.ini - The proper way.
« Reply #2 on: November 16, 2006, 10:52:20 AM »
So I just add the line to the template, and all is good?

spook

Editing php.ini - The proper way.
« Reply #3 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 ;)

Offline Terry

  • ***
  • 46
  • +0/-0
    • http://brummell.net
Editing php.ini - The proper way.
« Reply #4 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.

hackersoft

Editing php.ini - The proper way.
« Reply #5 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!

spook

Editing php.ini - The proper way.
« Reply #6 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?

duncan

Editing php.ini - The proper way.
« Reply #7 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

Offline william_syd

  • *****
  • 1,608
  • +0/-0
  • Nothing to see here.
    • http://www.magicwilly.info
Re: Editing php.ini - The proper way.
« Reply #8 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.
Regards,
William

IF I give advise.. It's only if it was me....

spook

Editing php.ini - The proper way.
« Reply #9 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.

Offline william_syd

  • *****
  • 1,608
  • +0/-0
  • Nothing to see here.
    • http://www.magicwilly.info
Editing php.ini - The proper way.
« Reply #10 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?
Regards,
William

IF I give advise.. It's only if it was me....

Offline william_syd

  • *****
  • 1,608
  • +0/-0
  • Nothing to see here.
    • http://www.magicwilly.info
Editing php.ini - The proper way.
« Reply #11 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/
Regards,
William

IF I give advise.. It's only if it was me....

spook

Editing php.ini - The proper way.
« Reply #12 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...

Offline william_syd

  • *****
  • 1,608
  • +0/-0
  • Nothing to see here.
    • http://www.magicwilly.info
Editing php.ini - The proper way.
« Reply #13 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.
Regards,
William

IF I give advise.. It's only if it was me....

Offline william_syd

  • *****
  • 1,608
  • +0/-0
  • Nothing to see here.
    • http://www.magicwilly.info
Editing php.ini - The proper way.
« Reply #14 on: November 17, 2006, 12:07:21 AM »
Regards,
William

IF I give advise.. It's only if it was me....

Offline judgej

  • *
  • 375
  • +0/-0
Re: Editing php.ini - The proper way.
« Reply #15 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
-- Jason

spook

Editing php.ini - The proper way.
« Reply #16 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.

Offline william_syd

  • *****
  • 1,608
  • +0/-0
  • Nothing to see here.
    • http://www.magicwilly.info
Editing php.ini - The proper way.
« Reply #17 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.
Regards,
William

IF I give advise.. It's only if it was me....