Does anyone know how to edit the php.ini file on VPS?

vps

#1

I need to add some code:

To fix a program I’m using. But I cannot locate this file.


#2

Read: http://wiki.dreamhost.com/PHP.ini

If you are using PHP 5.3 or 5.4, this should be pretty easy.

If you are using PHP 5.2, you should strongly consider updating your site to use 5.3 or later.


#3

It’s 5.4 I just moved our site to it and i’m getting a huge number of error notices that I need to remove to gain access to the program to clear the problem…

And that looks confusing, but I’ll try in the morning thank you Andrew…


#4

Okay, I did the steps as listed on that wiki article and made a folder at:

/USERNAME/.php/5.4/

made a file and named it phprc

and that file is a text file with only this line in it

error_reporting = E_ALL & ~E_NOTICE

If this is correct, then the intended purpose of hiding errors is not working.

Thoughts please?


#5

did you create /USERNAME/ ?

by default when you log in via ftp or ssh you are positioned in /home/USERNAME/ If you added another /USERNAME/ then your file is at /home/USERNAME/USERNAME/.php/5.4/


#6

No, I added the .php directory to the existing username

So my path is:

/home/USERNAME/.php/5.4

and then the phprc file is located in the 5.4 folder

I can tell this is correct because I can see the .php folder and as well the domain folders as well which to me means that it is at the top level for the user if I understand this correctly?
[hr]
Maybe this is the problem.

Does this have to be done through an Admin user on the VPS or can you do this with any user on the VPS for their sites?


#7

E_ALL & ~E_NOTICE is already the default, and it only hides certain types of errors, not all. If you really want to hide all errors, you’d want something like:

The way you’re doing this is fine, though. You do not need an admin user on a VPS to make these changes — indeed, you don’t even need a VPS. (The same steps work fine on shared hosting, too.)


#8

Well it is on a VPS so that’s why I posted this here.

I’m getting errors appearing like the following when accessing a page:

Strict Standards: Non-static method Inspekt::makeSuperCage() should not be called statically in /home/XXC/example.com/gallery/include/init.inc.php on line 42

Strict Standards: Non-static method Inspekt_Supercage::Factory() should not be called statically in /home/XXC/example.com/gallery/include/inspekt.php on line 282

Strict Standards: Non-static method Inspekt::makeGetCage() should not be called statically, assuming $this from incompatible context in /home/XXC/example.com/gallery/include/inspekt/supercage.php on line 124

Strict Standards: Non-static method Inspekt_Cage::Factory() should not be called statically, assuming $this from incompatible context in /home/XXC/example.com/gallery/include/inspekt.php on line 147

Strict Standards: Non-static method Inspekt::makePostCage() should not be called statically, assuming $this from incompatible context in /home/XXC/example.com/gallery/include/inspekt/supercage.php on line 125

Strict Standards: Non-static method Inspekt_Cage::Factory() should not be called statically, assuming $this from incompatible context in /home/XXC/example.com/gallery/include/inspekt.php on line 170

Strict Standards: Non-static method Inspekt::makeCookieCage() should not be called statically, assuming $this from incompatible context in /home/XXC/example.com/gallery/include/inspekt/supercage.php on line 126

Strict Standards: Non-static method Inspekt_Cage::Factory() should not be called statically, assuming $this from incompatible context in /home/XXC/example.com/gallery/include/inspekt.php on line 192

Strict Standards: Non-static method Inspekt::makeEnvCage() should not be called statically, assuming $this from incompatible context in /home/XXC/example.com/gallery/include/inspekt/supercage.php on line 127

Strict Standards: Non-static method Inspekt_Cage::Factory() should not be called statically, assuming $this from incompatible context in /home/XXC/example.com/gallery/include/inspekt.php on line 215

Strict Standards: Non-static method Inspekt::makeFilesCage() should not be called statically, assuming $this from incompatible context in /home/XXC/example.com/gallery/include/inspekt/supercage.php on line 128

Strict Standards: Non-static method Inspekt_Cage::Factory() should not be called statically, assuming $this from incompatible context in /home/XXC/example.com/gallery/include/inspekt.php on line 238

Strict Standards: Non-static method Inspekt::makeServerCage() should not be called statically, assuming $this from incompatible context in /home/XXC/example.com/gallery/include/inspekt/supercage.php on line 134

Strict Standards: Non-static method Inspekt_Cage::Factory() should not be called statically, assuming $this from incompatible context in /home/XXC/example.com/gallery/include/inspekt.php on line 124

Yes, I changed the file path to protect the server info a little.

I think I want to turn off Strict Standards errors if nothing else, but if the settings are to suppress errors already then why does all this appear?

To clarify one thing, the code to put into the phprc file is the line of code alone and nothing else?


#9

The behavior you’re seeing is correct. “E_ALL & ~E_NOTICE” allows E_STRICT (“Strict Standards”) errors to be displayed under PHP 5.4 and later.

“error_reporting = 0” continues to be the correct solution if you really do want to suppress all PHP error messages.


#10

I don’t have a choice at the moment because to fix this mess I need access to the program and the errors have killed it.

Andrew, to be clear, the phprc file need only have that one line of code in it and nothing else?

Thank you for your help…


#11

Having started from scratch again, I opened the path via shell and then uploaded the file to the folder.

This appears to have worked and I think I can work on the issue now.

For the record, using “error_reporting = 0” alone in the phprc file was correct it seems as the syntax…