PHP version...

Discussion in 'Installation/Configuration' started by ctroyp, Oct 9, 2005.

Thread Status:
Not open for further replies.
  1. ctroyp

    ctroyp New Member HowtoForge Supporter

    I guess I don't have a choice. I will either have to install PHP manually or use another Linux distribution. Without PHP4, I cannot get PHPBB2, nor osCommerce to run.

    Can you offer any recommendations on installing PHP4 manually? Last time I used the installation instructions from PHP.net and it did not go so well. This is why I had to reinstall my Fedora server. Would it be better to install Apache seperately, then install PHP4 afterwards?
     
  2. falko

    falko Super Moderator Howtoforge Staff

    This is how you compile PHP4 (in this case it's 4.3.9) with Apache 1.3:

    Code:
    tar xvfz php-4.3.9.tar.gz
    cd php-4.3.9
    ./configure --with-apxs=/path/to/apxs --enable-track-vars --enable-sockets --with-config-file-path=/path/to/php.ini --enable-ftp  --with-mysql=/usr 
    make
    make install
    Before running configure, you can find out about all configuration options with
    Code:
    ./configure --help
    The /path/to/apxs is important, that integrates PHP into your Apache. For Apache2 it's --with-apxs2=/path/to/apxs2 (I think but I'm not quite sure right now...).

    After you've compiled PHP you have to restart Apache.
     
  3. ctroyp

    ctroyp New Member HowtoForge Supporter

    Okay. I plan to install Apache2 first, then I will move to the php.net installation instructions which are relevant to Apache2. Only thing, I will have to change the apxs2 path.

    I think I can handle this. At least this will be the first and ONLY Apache install on my system until I install ISPConfig. :)

    Thanks for posting the example...
     
  4. ctroyp

    ctroyp New Member HowtoForge Supporter

    It looks like PHP4 installed okay by using:
    Code:
    ./configure --with-apxs2=/usr/sbin/apxs --enable-track-vars --enable-sockets --with-config-file-path=/etc/php.ini --enable-ftp  --with-mysql
    
    make
    
    make install
    After installing, then restarting httpd I tried to search for my php.ini file and could not locate it. Notice above that I used "--with-config-file-path=/etc/php.ini". I couldn't find it in that location either.

    I ran updatedb and searched and it only found one instance of php.ini which is in the PHP-4.4.0 directory which is was was uncompressed from the .gz file.

    Any idea what happened? Should I ignore it or did I miss something that you can think of?
     
  5. ctroyp

    ctroyp New Member HowtoForge Supporter

    BTW, for others reading this thread, I had to install http-devel to get aspx2 before configuring the PHP4 install:
    Code:
    yum install httpd-devel
     
  6. ctroyp

    ctroyp New Member HowtoForge Supporter

    I entered a test .php file to my html directory and opened it in the browser and it seems o be working okay.
    Here is the code for the test file test.php:
    Code:
    <?php
    
    echo phpinfo();
    
    ?> 
    The results:

    Code:
    PHP Version 4.4.0
    
    [B]System[/B] 	                       Linux server1.strec.com 2.6.11-1.1369_FC4 #1 Thu Jun 2 22:55:56 EDT 2005 i686
    [B]Build Date[/B] 	               Oct 22 2005 12:25:30
    [B]Configure Command[/B] 	'./configure' '--with-apxs2=/usr/sbin/apxs' '--enable-track-vars' '--enable-sockets' '--with-config-file-path=/etc/php.ini' '--enable-ftp' '--with-mysql'
    [B]Server API[/B] 	               Apache 2.0 Handler
    [B]Virtual Directory Support[/B] 	disabled
    [B]Configuration File (php.ini) Path[/B] 	/etc/php.ini
    [B]PHP API[/B] 	                      20020918
    [B]PHP Extension[/B] 	           20020429
    [B]Zend Extension[/B] 	            20050606
    [B]Debug Build[/B] 	              no
    [B]Zend Memory Manager[/B]    enabled
    [B]Thread Safety[/B] 	             disabled
    [B]Registered PHP Streams[/B] 	php, http, ftp
    I still don't know why I cannot find the php.ini or php.conf file???
     
  7. falko

    falko Super Moderator Howtoforge Staff

    Copy that php.ini to /etc and customize it to your needs. :) php.ini isn't copied automatically to the location you specified using ./configure, it just tells PHP where to look for a php.ini. If it doesn't find one there then PHP uses default values.
     
  8. ctroyp

    ctroyp New Member HowtoForge Supporter

    That was easy enough. Thanks!

    I have everything installed now including ISPConfig. Problem is, when I try to access www.mydomain1.com it doesn't open the site. Actually, it doesn't do anything at all; it just stays on the current page I am at--my browser home page. This is what was happening before I had to reinstall???

    I can access www.mydomain1.com:81 to get to the ISPConfig panel, phpmyadmin, etc, but I cannot reach the website home page from www.mydomain1.com. :confused:

    It does the same when I enter the public IP--it doesn't go anywhere even if I enter http://mywanIP:80

    I did do a traceroute and it does arrive to my public WAN IP so it looks like the problem is here locally. It must be something in the main Apache install but can't figure out what???
     
    Last edited: Oct 23, 2005
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Some questions:

    When you setup the website www.mydomain1.com in ISPConfig, you used your internal IP?

    When you try to reach the website from inside your network, the DNS system resolves your external router IP? The port 80 is forwared from your router to your ISPConfig server?

    If this is all OK, then your router might have a spoofing protection and blocks these requests that come from Internal IP => External IP => Internal IP.

    But you can try this: On your windows client PC (I assume its windows?), that is inside your network, find the hosts file.

    On my PC its in:

    C:\windows\system32\drivers\etc\hosts

    Add a line like this:

    Code:
    192.168.0.55   www.mydomain1.com
    where the IP is your internal IP and the domain is your domain. This will override the normal DNS resolution for this PC for the domain. Then try to reach the domain in the browser on this PC.
     
  10. ctroyp

    ctroyp New Member HowtoForge Supporter

    Yes, 192.168.2.50, which is the private IP of my Fedora server.

    Port 80 is forwarded to 192.168.2.50, yes. When I try to access 192.168.2.50, the Routers WAN IP, www.mydomain1.com, or any other mix on port 80, nothing happens--it doesn't even try to load a page. When I try from another computer on my network, I get "The page cannot be displayed" message. I presume it is the same trying to access from outside my network.

    Yes, I have a WXP client. I tried it and I still get page not found...

    On my Fedora server (where ISPConfig is installed), under network configuration, what should be in my hosts file: 127.0.0.1, or 192.168.2.50? Should I do something similar that you explained for the WXP client?
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    No, leave the hosts file untouched on your server for now.

    Please open a console window on your windows PC and type in:

    ping www.mydomain1.com

    Which IP did ping show? It must be the internal IP if the entry in the hosts file is recognized.

    If thats OK, to next step :)

    On your Server, there must be a line like this in your apache configuration file:

    Include /etc/apache/vhosts/Vhosts_ispconfig.conf

    The line might be slightly different depending on your directories. The apache configuration file can be httpd.conf, apache.conf or apache2.conf.

    If you found it, please post the content of the relevant vhost for www.mydomain1.com from the Vhosts_ispconfig.conf file.
     
  12. ctroyp

    ctroyp New Member HowtoForge Supporter

    "Reply from 192.168.2.50"

    It is entered as:
    Code:
    Include /etc/httpd/conf/vhosts/Vhosts_ispconfig.conf
    And here is the content for this file:
    Code:
    ###################################
    #
    # ISPConfig vHost Configuration File
    #         Version 1.0
    #
    ###################################
    #
    NameVirtualHost 192.168.2.50:80
    #
    #
    ######################################
    # Vhost: www.mydomain1.com:80
    ######################################
    #
    #
    <VirtualHost 192.168.2.50:80>
    ServerName www.mydomain1.com:80
    ServerAdmin [email protected]
    DocumentRoot /home/www/web1/web
    ServerAlias mydomain1.com
    DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl index.jsp Default.htm default.htm
    ScriptAlias  /cgi-bin/ /home/www/web1/cgi-bin/
    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl
    ErrorLog /home/www/web1/log/error.log
    AddType application/x-httpd-php .php .php3 .php4 .php5
    <Files *.php>
        SetOutputFilter PHP
        SetInputFilter PHP
    </Files>
    <Files *.php3>
        SetOutputFilter PHP
        SetInputFilter PHP
    </Files>
    <Files *.php4>
        SetOutputFilter PHP
        SetInputFilter PHP
    </Files>
    <Files *.php5>
        SetOutputFilter PHP
        SetInputFilter PHP
    </Files>
    php_admin_flag safe_mode On
    php_admin_value open_basedir /home/www/web1/
    php_admin_value file_uploads 1
    php_admin_value upload_tmp_dir /home/www/web1/phptmp/
    php_admin_value session.save_path /home/www/web1/phptmp/
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
    Alias /error/ "/home/www/web1/web/error/"
    ErrorDocument 400 /error/invalidSyntax.html
    ErrorDocument 401 /error/authorizationRequired.html
    ErrorDocument 403 /error/forbidden.html
    ErrorDocument 404 /error/fileNotFound.html
    ErrorDocument 405 /error/methodNotAllowed.html
    ErrorDocument 500 /error/internalServerError.html
    ErrorDocument 503 /error/overloaded.html
    AliasMatch ^/~([^/]+)(/(.*))? /home/www/web1/user/$1/web/$3
    AliasMatch ^/users/([^/]+)(/(.*))? /home/www/web1/user/$1/web/$3
    </VirtualHost>
    #
    #
    #
    ######################################
    # Vhost: www.mydomain2.com:80
    ######################################
    #
    #
    <VirtualHost 192.168.2.50:80>
    ServerName www.mydomain2.com:80
    ServerAdmin [email protected]
    DocumentRoot /home/www/web2/web
    ServerAlias mydomain2.com
    DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl index.jsp Default.htm default.htm
    ScriptAlias  /cgi-bin/ /home/www/web2/cgi-bin/
    AddHandler cgi-script .cgi
    AddHandler cgi-script .pl
    ErrorLog /home/www/web2/log/error.log
    AddType application/x-httpd-php .php .php3 .php4 .php5
    <Files *.php>
        SetOutputFilter PHP
        SetInputFilter PHP
    </Files>
    <Files *.php3>
        SetOutputFilter PHP
        SetInputFilter PHP
    </Files>
    <Files *.php4>
        SetOutputFilter PHP
        SetInputFilter PHP
    </Files>
    <Files *.php5>
        SetOutputFilter PHP
        SetInputFilter PHP
    </Files>
    php_admin_flag safe_mode On
    php_admin_value open_basedir /home/www/web2/
    php_admin_value file_uploads 1
    php_admin_value upload_tmp_dir /home/www/web2/phptmp/
    php_admin_value session.save_path /home/www/web2/phptmp/
    Alias /error/ "/home/www/web2/web/error/"
    ErrorDocument 400 /error/invalidSyntax.html
    ErrorDocument 401 /error/authorizationRequired.html
    ErrorDocument 403 /error/forbidden.html
    ErrorDocument 404 /error/fileNotFound.html
    ErrorDocument 405 /error/methodNotAllowed.html
    ErrorDocument 500 /error/internalServerError.html
    ErrorDocument 503 /error/overloaded.html
    AliasMatch ^/~([^/]+)(/(.*))? /home/www/web2/user/$1/web/$3
    AliasMatch ^/users/([^/]+)(/(.*))? /home/www/web2/user/$1/web/$3
    </VirtualHost>
    #
    #
    #
    BTW, I have replaced my actual domains with mydomain1 and mydomain2 for privacy. I can provide this info should you need it though.
     
  13. ctroyp

    ctroyp New Member HowtoForge Supporter

    I ran a ping and traceroute for www.mydomain1.com from my Fedora server to see if it would return 192.168.2.50 like the WXP client did. Well, it did not. It returned my WAN (public) IP. This tells me that it is not routing to my private IP 192.168.2.50. Is this assumption correct?
     
  14. till

    till Super Moderator Staff Member ISPConfig Developer

    Your vhost config in the post above is OK.

    No, this behaviour is OK. Your Fedora box uses the normal DNS resolution.

    Currently i have no idea what might be wrong in your setup :confused:
     
  15. ctroyp

    ctroyp New Member HowtoForge Supporter

    That's funny. Falko said the same thing just before I reinstalled my server. ;)

    I just don't understand...this system worked perfectly before. Everything was functional until I tried installing PHPBB2 and osCommerce on one of my sites. Neither application would accept the main Apache's PHP5. This is when I attempted to downgrade to PHP4 and when this problem began. I reinstalled and started from scratch, but the only thing I did different was in "Fedora-The Perfect Setup" instructions, I didn't install PHP5 as directed, rather I installed PHP4. That is it though, I don't understand why it doesn't work. The vhosts seem correct, dns, routing, etc... I am lost too and am unsure where to go with this.

    If PHPBB2 and osCommerce were compatable with PHP5, I wouldn't have a problem. They have mods for this, but they still didn't help. I think this system is cursed... :(
     
  16. ctroyp

    ctroyp New Member HowtoForge Supporter

    Just to update, I have been pulling my hair out trying to figure this problem out. It must have something to do with the PHP4 installation on my main Apache since the PHP5 setup with "The Perfect Setup" worked fine last time. With this in mind, does it clue you in to any possibilities?
     
  17. falko

    falko Super Moderator Howtoforge Staff

    But Apache is running? Do you see it when you run
    Code:
    netstat -tap
    ? Can you also post the output of
    Code:
    iptables -L
    ?
    Anything in the Apache error logs?
     
  18. ctroyp

    ctroyp New Member HowtoForge Supporter

    It appears to be:
    Code:
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address               Foreign Address             Stat                                              e       PID/Program name
    tcp        0      0 *:imaps                     *:*                         LIST                                              EN      2004/xinetd
    tcp        0      0 *:32769                     *:*                         LIST                                              EN      1619/rpc.statd
    tcp        0      0 *:pop3s                     *:*                         LIST                                              EN      2004/xinetd
    tcp        0      0 server1.strec.com:32775     *:*                         LIST                                              EN      2699/nautilus
    tcp        0      0 *:mysql                     *:*                         LIST                                              EN      2095/mysqld
    tcp        0      0 *:netbios-ssn               *:*                         LIST                                              EN      31168/smbd
    tcp        0      0 *:pop3                      *:*                         LIST                                              EN      2004/xinetd
    tcp        0      0 *:imap                      *:*                         LIST                                              EN      2004/xinetd
    tcp        0      0 *:sunrpc                    *:*                         LIST                                              EN      1601/portmap
    tcp        0      0 *:81                        *:*                         LIST                                              EN      27551/ispconfig_htt
    tcp        0      0 *:ftp                       *:*                         LIST                                              EN      28757/proftpd: (acc
    tcp        0      0 server1.strec.com:ipp       *:*                         LIST                                              EN      15612/cupsd
    tcp        0      0 server1.strec.com:5335      *:*                         LIST                                              EN      1899/mDNSResponder
    tcp        0      0 *:smtp                      *:*                         LIST                                              EN      28725/master
    tcp        0      0 *:microsoft-ds              *:*                         LIST                                              EN      31168/smbd
    tcp        0      0 localhost:netbios-ssn       localhost:4024              ESTA                                              BLISHED 5199/smbd
    tcp        0      0 server1.strec.com:42157     server1.strec.com:5335      ESTA                                              BLISHED 2699/nautilus
    tcp        0      0 server1.strec.com:5335      server1.strec.com:42157     ESTA                                              BLISHED 1899/mDNSResponder
    tcp        0      0 *:http                      *:*                         LIST                                              EN      24070/httpd
    ESTA                                              BLISHED 7337/2
    
    Code:
    Chain FORWARD (policy ACCEPT)
    target     prot opt source               destination
    
    Chain INPUT (policy ACCEPT)
    target     prot opt source               destination
    
    Chain OUTPUT (policy ACCEPT)
    target     prot opt source               destination
    
    Chain RH-Firewall-1-INPUT (0 references)
    target     prot opt source               destination
    ACCEPT     all  --  anywhere             anywhere
    ACCEPT     icmp --  anywhere             anywhere            icmp any
    ACCEPT     ipv6-crypt--  anywhere             anywhere
    ACCEPT     ipv6-auth--  anywhere             anywhere
    ACCEPT     udp  --  anywhere             224.0.0.251         udp dpt:5353
    ACCEPT     udp  --  anywhere             anywhere            udp dpt:ipp
    ACCEPT     all  --  anywhere             anywhere            state RELATED,ESTABLISHED
    ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ssh
    ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:http
    ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:ftp
    ACCEPT     tcp  --  anywhere             anywhere            state NEW tcp dpt:smtp
    REJECT     all  --  anywhere             anywhere            reject-with icmp-host-prohibited
    
    I looked through the logs and didn't see much rel. info. I will look again and see if something has popped up...thanks!
     
  19. ctroyp

    ctroyp New Member HowtoForge Supporter

    Here is something I found in the httpd error log that seems to generate during an httpd restart:
    Code:
    [Sun Oct 23 20:50:31 2005] [notice] caught SIGTERM, shutting down
    [Sun Oct 23 20:50:32 2005] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
    [Sun Oct 23 20:50:33 2005] [notice] Digest: generating secret for digest authentication ...
    [Sun Oct 23 20:50:33 2005] [notice] Digest: done
    [Sun Oct 23 20:50:33 2005] [notice] LDAP: Built with OpenLDAP LDAP SDK
    [Sun Oct 23 20:50:33 2005] [notice] LDAP: SSL support unavailable
    [Sun Oct 23 20:50:33 2005] [notice] mod_python: Creating 4 session mutexes based on 256 max processes and 0 max threads.
    [Sun Oct 23 20:50:34 2005] [notice] Apache/2.0.54 (Fedora) configured -- resuming normal operations
    [Sun Oct 23 20:51:23 2005] [notice] child pid 24092 exit signal Segmentation fault (11)
    [Sun Oct 23 20:52:12 2005] [notice] child pid 24093 exit signal Segmentation fault (11)
    [Sun Oct 23 20:52:41 2005] [notice] child pid 24094 exit signal Segmentation fault (11)
    [Sun Oct 23 20:52:44 2005] [notice] child pid 24095 exit signal Segmentation fault (11)
    [Sun Oct 23 20:53:12 2005] [notice] child pid 24099 exit signal Segmentation fault (11)
    [Sun Oct 23 21:12:17 2005] [notice] child pid 24100 exit signal Segmentation fault (11)
    [Sun Oct 23 21:14:05 2005] [notice] child pid 24096 exit signal Segmentation fault (11)
    [Sun Oct 23 21:40:06 2005] [notice] child pid 24098 exit signal Segmentation fault (11)
    [Sun Oct 23 21:47:34 2005] [notice] child pid 24911 exit signal Segmentation fault (11)
    [Sun Oct 23 22:11:49 2005] [notice] child pid 24473 exit signal Segmentation fault (11)
    [Sun Oct 23 22:22:31 2005] [notice] child pid 24486 exit signal Segmentation fault (11)
    [Sun Oct 23 23:09:23 2005] [notice] child pid 24949 exit signal Segmentation fault (11)
    [Sun Oct 23 23:20:39 2005] [notice] child pid 26439 exit signal Segmentation fault (11)
    [Mon Oct 24 00:40:44 2005] [notice] child pid 25790 exit signal Segmentation fault (11)
    [Mon Oct 24 00:40:44 2005] [notice] child pid 25939 exit signal Segmentation fault (11)
    [Mon Oct 24 00:40:44 2005] [notice] child pid 26654 exit signal Segmentation fault (11)
    [Mon Oct 24 00:40:44 2005] [notice] child pid 27621 exit signal Segmentation fault (11)
    In the ispconfig_access_log (in /etc/httpd/logs/) I found only one entry:
    Code:
    www.mydomain1.com||||309||||67.141.155.36 - - [23/Oct/2005:18:06:11 -0400] "GET / HTTP/1.0" 400 309 "-" "-"
    Any other logs to look at?
     
  20. falko

    falko Super Moderator Howtoforge Staff

    Hm, your firewall seems to be ok, but your Apache is dying for some reason, and it's hard to find out why without having a look at the machine...

    Is it necessary that you stick to Fedora? If not I'd suggest you try the Debian setup ( http://www.howtoforge.com/perfect_setup_debian_sarge ), it comes with PHP4 (btw, there are also PHP5 packages available for Debian).
     
Thread Status:
Not open for further replies.

Share This Page