Customizing PHP


#1

First off, I am a total rank newb at this. I am trying to set up PHP for my site so that I can use a custom php.ini. I gather that there are a couple ways to do this - either compile my own PHP or set up a custom configured php.ini. I’d prefer to do the latter, but I’m having no luck following the instructions at http://wiki.dreamhost.com/index.php/PHP.ini

The main problem is I don’t know what I’m doing. I finally did manage to use PuTTY to shell to my account, but I can’t get the instructions to work. For example, when I enter “chmod +x php-update.sh”, the response is “Operation not permitted”, and I don’t have a clue how to fix this. So at this point, I’m basically stuck and/or clueless.

I would appreciate any suggestions for what I’m doing wrong, or for resources (books or on-line articles) to help me get less noobified on this.

Thanks.


#2

OK, I don’t believe this, but I think I figured out what I was doing wrong. (Don’t ask - I’m a dummy - I think I was logged in to my account wrong.)

Any suggestions for resources to de-noobify myself would still be greatly appreciated. I am struggling mightily with this stuff.

Thanks.


#3

You are already on the path, young grasshoppah.

I’m an electrical engineer that learned all this nonsense while stringing power into computer rooms c.1985-87 - one of the pseudo-quantum leaps one must accept is that oftentimes finding the way to do something is plodding through a quite-possibly exhaustive list of things that Just! Don’t! Work!

So have fun crashing/trashing your site - if you’re at all like me, it’s gonna happen quite a bit.

Just try not to take the whole server down with ya. :slight_smile:


#4

I see this kind of thing here a lot: inexperienced[1] people trying to figure out SSH, tarballs, compiling, and so on, so they can have a customized PHP installation of their own. My question is, why? I suspect a lot of people are doing this when they really don’t need to.

[1] I don’t mean this to be a slight, everyone was inexperienced at some point and every one of these people can probably do lots of stuff I can’t.

What do you need to change that can’t be done via ini_set() or some other work-around? Have you given any thought to the fact that installing your own also means you are responsible for keeping up on security patches and the like? Once you do it, you’ll need to keep doing it, as these patches are released.

I understand that some third-party web applications require certain things that aren’t available here (eg, url_fopen), but for every one of these there are probably multiple comparable applications that will work just fine. And given how minor a modification is needed to use CURL instead, an e-mail to the software developer just may get you a patch or updated version.

Can someone, or multiple people, please enlighten me?


If you want useful replies, ask smart questions.


#5

as far as being responsibe for keeping your php up-to-date that is mentioned in the wiki article, for whatever that’s worht.

I personally followed the script in the wiki to simply use my own php.ini file that is copied out from the DH system on a weekly basis so I don’t have to keep things up to date. The modifications I make to php.ini is to allow slightly larger uploads (10mb), and up the max excution time and input time.

I know that for some people they need php compiled with certain options. This normally allows php to access a functionality that other app accomplishing a simliar thing would also need. For instance if you’re running a photo-blog and would like to use the php exif functions to display picutre data php has to be compiled with the exif option. With out that option you can’t use any of those ‘native’ php functions. It so happens that my example, exif, is compiled with DH’s default php but the principle holds true.

As far as a choice of other applications, that’s more up to the user. It may well be that this one application is the only one of it’s type that offers a particular feature. For instance I’ve been looking for an open source recipe site management system. The one I’m checking out right now is what lead me to set it up to use my own php.ini file. The app isn’t compatable with php5 or mysql 5. However it’s the only setup that will create a meal calender for you. It’s also apart of a much shorter list of apps that suport images, and allow users to register and store ‘favorite recipies’ and ‘shopping lists’.

Unfortunatly for me the author isn’t working on the program any more, he’s too busy with a paying job to be updating it any more. So for now I’m stuck with the way it is unless I’m going to invest the time to put in an extensive rewrite of his app.

I’m willing to bet that at least a few people are using this method when there’s a better / safer way to do things, but there’s also a lot of people who arn’t. This is also part of what brought me to DH, and I’m sure innumerable others as well - the ability to ssh into my server and do what I want (within the TOS)

–Matttail
art.googlies.net - personal website


#6

I think this “user contribution” on the php.net page you linked in your post may have a lot to do with “What do you need to change that can’t be done via ini_set()”:

"[[[Editors note: Yes, this is very true. Same with
register_globals, magic_quotes_gpc and others.
]]]

Many settings, although they do get set, have no influence in your script… like upload_max_filesize will get set but uploaded files are already passed to your PHP script before the settings are changed.

Also other settings, set by ini_set(), may be to late because of this (post_max_size etc.).
beware, try settings thru php.ini or .htaccess."

Some of the more common “workarounds” using .htaccess might also not work on dreamhost, depending upon the apache configuration.

And, I think that sometimes a user just wants to run a particular piece of software :wink:
–rlparker


#7

What do you need to change that can’t be done via ini_set() or some other work-around?

Didn’t know anything about ini_set(). That’s how inexperienced I am. That’s something else for me to look into. I came to Dreamhost from another host who shall remain nameless. This other host recommended installing a custom php.ini, and so, being the novice that I am, I gravitated in that same direction. But now I see from the comments posted here that there are some other options, which I’ll look into.

Quite honestly I don’t fully understand half the stuff that you guys are talking about in your comments on this thread, but learning that stuff’s all part of the challenge.

Oh, BTW, my understanding from the wiki article is that using the method which I did to install a custom php.ini means that I should NOT have to update php myself, that Dreamhost’s updates will still take place normally. I am mistaken about that?

Thanks for all your comments, they’ve been useful.

Kevin


#8

You’re correct. Following the instructions for in the article called php.ini you set crontab up to copy out DH’s php.ini file on a weekly basis. So after DH updates php, you’re will be as well - within a week.

–Matttail
art.googlies.net - personal website


#9

I feel like I may be in the same boat… or maybe even hanging over the side of it, drowning! :slight_smile:

I would REALLY love to increase the post max file size but, in reading over and over again the instructions in the WIKI post, I just become more frustrated! I have no clue what it is talking about. I got as far as making a folder on my server called ‘cgi-bin’ and then creating a file, which is probably totally coded wrong, called php_update.sh

I used Dreamweaver to do both of these tasks. Then, using my best guess, I went to my browser and put in the address for the php_update.sh file, which prompted me to download it.

I don’t know what “shell” means and all of that other jargon - I’m clueless and slightly more frustrated than I was 5 minutes ago! haha

Dreamhost support has left me hangin out here on my own, which is a first. ANY help would be great. Sorry for the newbie post but, you gotta start somewhere :slight_smile:

Thanks
Robin


#10

Well, dreamweaver is probably not going to be your best friend in the situation. In fact you might find it simplest to do it all through ‘shell’. I’ll give you a breif explination here, and then I reccomend that you start a new thread here with specific questions.

‘Shell’ is a way to access your server’s ‘command line’. Like the MS-Dos prompt the command line is a way to issue commands to your server through a text-only mode. It may look scarry at first, but it’s really very easy. Read the Wiki article on SSH to learn how to access this ‘shell’. If you’ve heard of telnet before, then know that SSH is the secure version of telnet.

Now, if I were doing this I would just use one of the text editors aviable on your server through shell. my favorite is called “nano”. It’s very easy to use - especially for copy, paste, and edit a few lines. you can have nano create the new file for you - after you’ve loged into ssh it would go something like this:

nano -w php_update.sh

After you type that and press enter nano will come up. (the -w flag turns off line wraping so that your commands don’t get messed up.) copy the script from the wiki and paste it into nano. If you’re using putty right clicking should do it, or press ctrl-shift-v. Once you’ve edited the appropiate lines press ctrl-o to write out the file and ctrl-x to exit.

The rest of the commands that the wiki article talks about will be carried on through your shell connection as well. The “.sh” extension is a shell script.

If you need help changing that script around to edit different fileds, post that in your new thread and someone will help you out. The wiki often has articles that cover all that jargon, but they’re not always obviously named - so try searching for anything that confuses you first and then post if you can’t find it. Hope this helps…

–Matttail
art.googlies.net - personal website