Announcement

Collapse
No announcement yet.

Php5 / Mysql 4.1.9 Howto

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Sounds nice. I am planning on putting PHP 5 on our box in the background soon. I have it working on my non-IWorx box at home. PHP4 is installed as normal as an Apache module and PHP5 is located in the cgi-bin. If I have PHP5 files in a directory I can add these lines to a .htaccess file (or for IWorx, .htaccess or /etc/httpd/conf.d/domain.tld.conf for domain-wide changes)
    Code:
    AddType application/x-httpd-php-cgi .php
    Action application/x-httpd-php-cgi /cgi-bin/php5
    I don't know how well this works because my PHP5 code there is still pre-pre-alpha.

    Comment


    • #17
      CMI

      did you install php5 from RPMs ?
      Could you please provide a brief Howto.

      For me there is only to install PHP with the option --force-redirect-cgi ?
      then apply this (I'd prefer to have .php5 than .php but not sure)
      AddType application/x-httpd-php-cgi .php5
      Action application/x-httpd-php-cgi /cgi-bin/php5

      Does it means that all php5 have to be in the cgi-bin/php5 repertory and are readable from http://domaine.tld/cgi-bin/php5/ or can they be readable from http://domaine.tld ?

      What about the location of the BIN php, where did you install it, and the php.ini ?

      I'm looking for a php5-cgi RPM for centos

      arff not have too much time at the moment, but I'd really like to di this asap

      Thanks CMI
      Pascal

      Comment


      • #18
        I installed from source as to not clobber anything, although I'm using Gentoo at home and I could install mod_php4 while using PHP5 for CLI and CGI. When you build the source code you can look for sapi/cgi/php which will be suitable for dropping in cgi-bin.

        If you go with the .php5 extension, you can do this server-wide. Personally, I think .php5 is ugly and will cause problems in the future which is why I didn't do it.

        /cgi-bin/php5 needs to be where ever Apache will look for it. For me, it looks under the localhost site. The actual files can be anywhere, so long as they are accessable by the php5 app.

        As a reminder, I haven't tried this on our IWorx box yet, only at home. I didn't look into security considerations and performance tweaking yet, so I wouldn't do this in a production environment without a little review first.

        Comment


        • #19
          As a reminder, I haven't tried this on our IWorx box yet, only at home. I didn't look into security considerations and performance tweaking yet, so I wouldn't do this in a production environment without a little review first.
          Absolutly, it's the reason why we would like to install it on our iworx test box.

          My idea was to ask to interworx team if they already have an php5-cgi rpm home made. (I prefer rpm, as it is easly removable)

          If not, I think I'll use the ./configure that is in the php.spec file of the php4 iworx's rpm. Of course I'll add --force-redirect-cgi (think it is enough)

          Thanks CMI for your advises

          Pascal

          Comment


          • #20
            My idea was to ask to interworx team if they already have an php5-cgi rpm home made. (I prefer rpm, as it is easly removable)
            We don't Pascal, and probably won't, at least in the near future.

            Btw, PaulK, will be finisihing up your box today I hope.

            Chris
            Chris Wells
            InterWorx L.L.C. | http://interworx.com
            InterWorx Control Panel

            Comment


            • #21
              Thanks Chris

              I have installed php5 from source.

              I used a minimum ./configure to only do some tests.
              ./configure \
              --prefix=/usr/php5/ \
              --with-config-file-path=/etc/php5/ \
              --with-config-file-scan-dir=/etc/php5/php.d/ \
              --disable-debug \
              --disable-rpath \
              --with-xml \
              --with-zlib \
              --with-mysql
              In an existing domain I added in at the bottom of the vhost config file :
              AddHandler application/x-httpd-php5 .php5
              Action application/x-httpd-php5 /bin/php
              ScriptAlias /bin/ /usr/php5/bin/
              and I have created a file called phpinfo.php5 with only
              PHP Code:
              <?
              phpinfo();
              ?>
              When I launch it from the box
              /usr/php5/bin/php /home/account/domain.tld/html/phpinfo.php5
              it works great

              but when I launch it from the web
              http://hebergement-serveurs.fr/phpinfo.php5

              I have an error 500 (internal server error)
              Internal Server Error
              The server encountered an internal error or misconfiguration and was unable to complete your request.

              Please contact the server administrator, webmaster@hebergement-serveurs.fr and inform them of the time the error occurred, and anything you might have done that may have caused the error.

              More information about this error may be available in the server error log.
              Looking at the log I only have this
              [error] [client xxx.xxx.xxx.xxx] Premature end of script headers: php
              Any idea ?

              Pascal

              Comment


              • #22
                Erff of course !!!

                It is due to the SuexecUserGroup xxxxxxx xxxxxxxx

                I have commented it and now it works fine

                http://hebergement-serveurs.fr/phpinfo.php5

                Pascal

                Comment


                • #23
                  I ran into the same problem on my test machine but haven't yet had the time to work on that. I'd like suEXEC working with PHP5 as a CGI but considering the paranoia around the suexec binary I can't really tell what the problem is. If anyone has an idea I'd be greatfull for the time saver.

                  Comment


                  • #24
                    The /var/log/httpd/suexec* log files will shed light. suexec just does a series of checks before it execs a script. The usual culprits of suexec not working are:

                    1. your script is owned by some other user than suexecusergroup says.

                    2. the directory in which your script lives in owned by someone other than suexecusergroup

                    3. the perms on your script and/or directory are too lenient (711 for each is fine).

                    The list goes on, and the options are better prioritized here:

                    http://httpd.apache.org/docs/suexec.html#model

                    Chris
                    Chris Wells
                    InterWorx L.L.C. | http://interworx.com
                    InterWorx Control Panel

                    Comment


                    • #25
                      Thanks Chris. I forgot about the minimum UID restriction. That's what was killing me.

                      Comment


                      • #26
                        The error is because the doc_root is not set correctly

                        [2005-06-18 10:10:59]: uid: (xxx/zzzzz) gid: (xxx/xxx) cmd: php
                        [2005-06-18 10:10:59]: command not in docroot (/usr/php5/bin/php)
                        indeed, if I copy the php binary in /home/account/domain.tld/html/cgi-bin/
                        then chown it to the user account
                        and change the vhost config file to add
                        AddHandler application/x-httpd-php5 .php5
                        Action application/x-httpd-php5 /cgi-bin/php

                        ScriptAlias /cgi-bin/ /home/hebergem/hebergement-serveurs.fr/html/cgi-bin/
                        then it works fine

                        The pbm with this mean that I'll have to copy the php binary in the doc root.
                        I wouldn't do this for every account that would like to use php5

                        Have you got an idea

                        Pascal
                        Last edited by pascal; 06-18-2005, 03:24 AM.

                        Comment


                        • #27
                          Well pascal, that is the best thing to do I can think of at the moment. (You should be able to put the binary in the skel directory, and run some script to update the binary in everyone's directories. Doing things this way is no different then having the individual users use their own cgi scripts, which just happen to be the php5 binary in this case. The other option is to modify the suEXEC binary to skip the requirement to have target UID/GID match script UID/GID.

                          Comment


                          • #28
                            What command are you trying to run from the browser here Pascal? php itself? Or are you trying to run a script that uses PHP #!/usr/bin/php style?

                            The php binary itself doesn't need to be in the webspace, just as /usr/bin/perl doesn't for perl based CGI scripts. There must be something else going on here.

                            Chris
                            Chris Wells
                            InterWorx L.L.C. | http://interworx.com
                            InterWorx Control Panel

                            Comment


                            • #29
                              Originally posted by IWorx-Chris
                              Btw, PaulK, will be finisihing up your box today I hope.

                              Chris
                              Thanks Chris, I see that MySQL 4.1.10a has been on there for a bit, but PHP has not been upgraded to 5 yet. Are you planning on doing that today?

                              Comment


                              • #30
                                Going to try Paul, it's been a bigger pain than I had wanted trying to generalize the php5 RPM. But I will give it a go today and let you know.

                                Chris
                                Chris Wells
                                InterWorx L.L.C. | http://interworx.com
                                InterWorx Control Panel

                                Comment

                                Working...
                                X