PHP Installation & php.ini

apps

#1

I’m trying to install Serendipity, a blogging tool and currently have the following settings flagged by the installer:

Installation:
OpenSSL extension -> No [“Yes” recommended]
mbstring extension -> No [“Yes” recommended]
iconv extension -> No [“Yes” recommended]

php.ini
register_globals [OFF recommended] [ON currently]
magic_quotes_gpc [OFF recommended] [ON currently]
session.use_trans_sid [OFF recommended] [ON currently]
allow_url_fopen [ON recommended] [OFF currently]
post_max_size [10M recommended] [8M currently]
upload_max_filesize [10M recommended] [7M currently]

After reading about allow_url_fopen, it’s not too big an issue, I’m wondering if the other settings are, and if they are, how, if possible, can they be modified.

Any help or information is appreciated. TIA.


#2

gotta compile you’re own version of PHP to be able to do that. Check the DH Wiki site for instructions.


#3

Should I install this for the hosting account or for each domain/subdomain?

When I try installing for a subdomain, it automatically installs in the root.

cd sub1.mydom.com
then creating the script, running it. (I have changed the script to reflect sub1.mydom.com


#4

You do one giant make for your one (or multiple) account(s), providing they are on the same server.

Then you can copy the php binary into each sub-domain/domain directory you need to use it in.


#5

Assuming your application is well-written (which it probably is if it’s recommending turning off stuff like register_globals, etc), none of that stuff should really matter (with the possible exception of the max filesizes, if you’re going to have people uploading files).

If you’re using PHP as an Apache module (as opposed to CGI), you can toggle some of those things in .htaccess:

php_flag register_globals off php_flag short_open_tag off php_flag magic_quotes_gpc off php_flag magic_quotes_runtime off php_flag session.use_trans_sid off

If you want useful replies, ask smart questions.


#6

Thanks for the replies.

The blog seems to run fine, with the exception that it can’t find ImageMagick (which is supposed to be in /usr/bin/convert).

I’ve tried installing php5 using the wiki and running a phpinfo test, but am getting “500 Internal Server Error”

As of now, I’ve got the following:
/home/myuser/

  • etc
  • php
  • src

/home/myuser/sub1.mydom.com

  • cgi-bin

I only want my subdomain to use php5, since this will be the blog.

I’ve also added:

  • include_path = “/home/myuser/php/lib/php” into /home/myuser/etc/php5/php.ini
  • .htaccess inside /home/myuser/sub1.mydom.com with:
    ==> AddHandler php5 .php .pcgi
    ==> Action php5 /cgi-bin/php.cgi

What am I doing wrong with file/directory placements and/or setup?

TIA


#7

“500 Internal Server Error” indicates an Apache misconfiguration (eg, in .htaccess). Check your error log:

$ tail logs/example.org/http/error.log

If you want useful replies, ask smart questions.


#8

I’d also suggest flipping the two lines:

[quote]AddHandler php5 .php .pcgi
Action php5 /cgi-bin/php.cgi[/quote]

You define an action adn then you’re assigning the action to a specified file extension. What you’re doing is the opposite.

Error log should shed a bit more light on the subject as well as 500 just means there’s an error someplace and the error is placed within the Error logs.


#9

The error I get looking through at the error log (/home/user/logs/sub1.mydom.com/http/error.log) is:

  • Premature end of script headers: /home/user/sub1.mydom.com/cgi-bin/php.cgi
    Then, it’s looking for internal_error.html, which is understandable.

Could this be a path? Relative/domain? Or include error?

I’ve edited the .htaccess file inside /home/user/sub1.mydom.com and swapped the order.

Also, do .htaccess files have to be created for each and every subdirectory under that domain? Testing out /home/user/sub1.mydom.com/test/phpinfo.php gives a “404 page not found” so it isn’t even parsing as php…

Trying yet another installation, this time, all files and directories inside /home/user/sub1.mydom.com


#10

Premature end of script headers: /home/user/sub1.mydom.com/cgi-bin/php.cgi

That’s one of those errors that could mean a number of things. A good place to start might be the Apache documentation on the subject of CGI.

Also, do .htaccess files have to be created for each and every subdirectory under that domain?

Your .htaccess file will affect the directory it’s in and any directories below it. So one in the root directory of your site will affect the entire site. You can override directives in the root-level .htaccess on a per-subdirectory basis by including another .htaccess file in whatever directory you want to be handled differently.

Testing out /home/user/sub1.mydom.com/test/phpinfo.php gives a “404 page not found” so it isn’t even parsing as php.

If your PHP isn’t being parsed, you’ll just see the code output to your browser, you won’t get a “not found” error. If you’re getting 404 errors where you don’t expect them, check your error log again to see what the server is looking for. Note that URL rewriting mistakes can cause unexpected 404 errors, so check that too if you’re doing any.


If you want useful replies, ask smart questions.


#11

6 installations later, and finally all greens on the installer.
Thanks for everyone’s help.

Next challenge, creating my own template…
Looking at Smarty and StyleMaster…


#12

[quote]6 installations later, and finally all greens on the installer.
Thanks for everyone’s help.[/quote]
Ah! The joys of debugging. lol

Glad you finally got it working! It was like that for me, too, with the PHP5 install. But it was more issues with bad libs, etc.