#1
  1. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Sep 2006
    Posts
    2,034
    Rep Power
    535

    How do "you" install PHP


    I've asked several related questions on this forum about how and why to install PHP from source, and didn't really get any good answers. I've asked similar questions on Apache and MySQL, and also did not receive any good answers.

    I am not trying to be pushy, just confused as the "official" documentation for PHP implies that they should be installed from source. For instance, you read the installation documentation at http://www.php.net/manual/en/install.unix.apache2.php and it only describes installing PHP from source. Apache and MySQL imply the same.

    Most users of Apache on unix-like systems will be better off downloading and compiling a source version.
    Source: http://httpd.apache.org/docs/2.4/install.html

    The recommended way to install MySQL on RPM-based Linux distributions is by using the RPM packages.
    Source: http://dev.mysql.com/doc/refman/5.5/...ation-rpm.html

    Everybody usually says "have you read and are you following the documentation" but it seems that for this case I should ignore the documentation and install via yum with a repository.

    I've spent the past few days building and rebuilding my servers, and would appreciate knowing how each of you install PHP, and why you do so.

    Thank you
  2. #2
  3. No Profile Picture
    Dazed&Confused
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2002
    Location
    Tempe, AZ
    Posts
    506
    Rep Power
    128
    I think each software's documents will always encourage compiling from source since that's the lowest common denominator. Those groups don't want to be responsible for documenting how to install it in every possible Linux distro with every possible installer.

    In the grand scheme of things I'd probably recommend the exact opposite. If you do the majority of your installations using yum, portage, etc., I imagine installing a large application by alternative means might lead to those installation tools losing track of the system state, diminishing their capacity to work correctly in the future.

    But I'm a Gentoo guy so I really only have experience with Portage. A simple install is as simple as:

    emerge php

    To include specific packages, something like:

    USE="soap" emerge php

    (and subsequently adding "soap" to package.use for the future)

    Portage then handles the installs/upgrades/reconfigurations of all dependencies.
  4. #3
  5. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6352
    I run linux on my personal/work laptop and we run unix on our servers. The servers are managed by our ops team, and I installed PHP on my laptop using simply apt-get.
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Sep 2006
    Posts
    2,034
    Rep Power
    535
    Thanks dmittner, I looked at Gentoo when you responding to my earlier post. Interesting, but not today.

    Thanks ManiacDan. Unfortunately, I don't have a ops team, and have to install it on my the server myself
  8. #5
  9. No Profile Picture
    Dazed&Confused
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2002
    Location
    Tempe, AZ
    Posts
    506
    Rep Power
    128
    Originally Posted by NotionCommotion
    Thanks dmittner, I looked at Gentoo when you responding to my earlier post. Interesting, but not today.
    Hehe. I'm not going to start an OS war by saying Gentoo is the best or anything. But the package manager is usually dependent on OS and I just wanted to make clear that Portage is my solution. But all the package managers these days seem to be rather similar in their simplicity.

    I would not be able to maintain my server without them. Makefiles, manual compiles, etc., is just too deep into administration knowledge for me. I'd have the OS wrecked within a week.
  10. #6
  11. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,180
    Rep Power
    9398
    Originally Posted by dmittner
    I think each software's documents will always encourage compiling from source since that's the lowest common denominator. Those groups don't want to be responsible for documenting how to install it in every possible Linux distro with every possible installer.

    In the grand scheme of things I'd probably recommend the exact opposite. If you do the majority of your installations using yum, portage, etc., I imagine installing a large application by alternative means might lead to those installation tools losing track of the system state, diminishing their capacity to work correctly in the future.
    +1

    Installing from source is the most flexible way to get exactly what you need, but Linux is at the point where most distributions (that matter ) have package managers to install software for you. If all you're doing is downloading and compiling the source you may just as well get it from your package manager instead. But if you need to make changes or enable/disable specific features, because of your requirements or your platform or whatever, or if you simply don't have a package manager, source is the (only) way to go.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Sep 2006
    Posts
    2,034
    Rep Power
    535
    Thanks requinix,

    Do you personally get them from your package manager?

    If on CentOS, would you recommend a particular repo?

    Thanks
  14. #8
  15. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,180
    Rep Power
    9398
    I use Ubuntu and yes, I apt-get install everything. Although Precise (previous version) only had PHP 5.3 and I wanted 5.4 (which Raring, the current version, has) so I added a new repository to my list to pull from.

    Doesn't CentOS have its own repos? You should be looking there first for everything. Looking in here I see packages for PHP 5.3.3 and for SOAP (two separate packages).
  16. #9
  17. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Sep 2006
    Posts
    2,034
    Rep Power
    535
    Thanks requinix,

    Yes, CentOS has its own repos? I didn't realize they had 5.3.3 with SOAP, and must have been doing something wrong. I ended up going with the ius repo and now have PHP 5.4.16 installed with SOAP.

    I think I am officially done with this install by source quest. Wasted a couple of days, but learned plenty. Thank you all for your patience.
  18. #10
  19. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,316
    Rep Power
    7170
    I almost always install from the package manager. The only situation in which I don't is if the repository doesn't have what I need in it. I'm not a sysadmin and don't have time to mess around with dependencies.

    The line from the MySQL manual that you quoted recommends using a package manager to install it.
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  20. #11
  21. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,445
    Rep Power
    4539
    Assuming fedora is similar to centos, you might want to do yum list "*php*" and review the long list of php add-on packages available.
    ======
    Doug G
    ======
    Bartender to Rene Descartes "have another beer?" Descartes: "I think not" and he vanished.
    --Alfred Bester
  22. #12
  23. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Sep 2006
    Posts
    2,034
    Rep Power
    535
    Originally Posted by E-Oreo
    The line from the MySQL manual that you quoted recommends using a package manager to install it.
    Yes, I agree, but it definitely didn't promote the use of yum or apt-get. PHP was worse, and Apache even more so. I find it very irresponsible of the three not to better acknowledge that the distributor's package manager is often the best choice.

    Originally Posted by Doug G
    Assuming fedora is similar to centos, you might want to do yum list "*php*" and review the long list of php add-on packages available.
    I believe it was my lacking of the *'s which caused me to miss PHP 5.3.3 w/ SOAP in CentOS's repo.
  24. #13
  25. Mad Scientist
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2007
    Location
    North Yorkshire, UK
    Posts
    3,661
    Rep Power
    4124
    I've never successfully installed from source. Here's my reference for getting a server up and running on a Centos 6.3 VPS. with PHP5.4, Mysql 5 and nginx

    Code:
    References:
    ===========
    
    http://www.webtatic.com/packages/php54/
    http://www.agileapproach.com/blog-entry/setting-lamp-stack-centos-and-rackspace-cloud-server
    
    Update Repos
    ============
    
    rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
    rpm -Uvh http://repo.webtatic.com/yum/el6/latest.rpm
    yum update yum
    
    
    NGINX
    =====
    
    make this file
    
    /etc/yum.repos.d/nginx.repo
    
    with this content
    
    [nginx]
    name=nginx repo
    baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
    gpgcheck=0
    enabled=1
    
    then run
    
    yum install nginx
    
    
    Instll some libs
    ================
    
    yum install openssl-devel zlib-devel gcc gcc-c++ make autoconf readline-devel curl-devel expat-devel gettext-devel
    yum install libjpeg libpng telnet libxslt freetype freetype-devel
    
    
    
    install mysql
    =============
    
    yum install mysql-server mysql-devel
    
    install apache (not if nginx has been installed)
    ==============
    
    yum install httpd-devel apr-devel 
    
    install php
    ===========
    yum install memcached
    yum install php54w
    yum install php54w-fpm
    yum install php54w-bcmath php54w-cli php54w-common php54w-dba php54w-devel php54w-embedded php54w-enchant php54w-fpm php54w-gd php54w-imap php54w-interbase php54w-intl php54w-ldap php54w-mbstring php54w-mcrypt php54w-mssql php54w-mysql php54w-odbc php54w-pdo php54w-pecl-memcache php54w-pecl-xdebug php54w-pgsql php54w-process php54w-pspell php54w-recode php54w-snmp php54w-soap php54w-tidy php54w-xml php54w-xmlrpc php54w-zts
    yum install pcre-devel
    pecl install apc
    
    add extension=apc.so to /etc/php.d/apc.ini
    
    install some more libs
    ======================
    
    yum install mod_ssl
    
    open ports in IPtables
    ======================
    
    edit /etc/sysconfig/iptables, add
    
    -I INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 80 -j ACCEPT
    -I INPUT -p tcp -m state --state NEW,ESTABLISHED --dport 443 -j ACCEPT
    
    restart
    
    service iptables stop
    service iptables start
    
    
    =========================
    configure NGINX
    
    mv /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.old
    
    mkdir /var/www/logs
    
    nano /etc/nginx/conf.d/default.conf
    
    
    server {
        server_name speedy;
        access_log /var/www/logs/access.log;
        error_log /var/www/logs/error.log;
        root /var/www/html;
    
        location / {
            index index.html index.htm index.php;
        }
    
        location ~ .php$ {
            include /etc/nginx/fastcgi_params;
            fastcgi_pass  127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME /var/www/html$fastcgi_script_name;
        }
    }
    
    
    chown -R nginx:nginx /var/www
    
    
    service mysqld start
    service php-fpm start
    service nginx start
    I said I didn't like ORM!!! <?php $this->model->update($this->request->resources[0])->set($this->request->getData())->getData('count'); ?>

    PDO vs mysql_* functions: Find a Migration Guide Here

    [ Xeneco - T'interweb Development ] - [ Are you a Help Vampire? ] - [ Read The manual! ] - [ W3 methods - GET, POST, etc ] - [ Web Design Hell ]
  26. #14
  27. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Sep 2006
    Posts
    2,034
    Rep Power
    535
    Originally Posted by Northie
    I've never successfully installed from source.
    I actually did successfully install PHP and Apache from source and MySQL directly from the RPM without yum, but then flattened my server and rebuilt it through more modern traditional means. Doing so for PHP was actually fairly easy, and my main reason for not doing so was maintenance of updates.

    Originally Posted by Northie
    Here's my reference for getting a server up and running on a Centos 6.3 VPS. with PHP5.4, Mysql 5 and nginx
    Thank you, this is helpful and I will compare against what I am doing. I seriously looked at webtatic as a PHP repo, but ended up going with ius as I understand they might be more aligned with CentOS. I am sure they are both good choices.
  28. #15
  29. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,180
    Rep Power
    9398
    Unless you need a custom installation, compiling from source nowadays typically means (a) using the package manager's option to build from source, if there is one
    Code:
    # apt-get source php5 --compile
    or (b) downloading then
    Code:
    $ ./configure && make && make install

IMN logo majestic logo threadwatch logo seochat tools logo