Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: PHP with Apache

  1. #1
    Join Date
    Jun 2008
    Location
    /dev/swat
    Posts
    1,181

    Default PHP with Apache

    hi to all,
    I install LAMP from Repo. But when i tried to run php files, it just give me save or open dialog box, mean not parsing php files. I check all conf files, all are OK. restart apache. did not work.
    Then i tried to reinstall the things. but same thing.Again i tried to install it and again same thing.
    Its really annoying. B4 everything was OK.but suddenly it start this behavior.
    Any ideas?
    Thanks
    Arif
    Linux[openSUSE, KDE], PHP, MySQL, Wordpress, Tech News, etc :
    http://anl4u.com

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: PHP with Apache

    Did you enable the php5 module in the Apache config? If you look in the file /etc/sysconfig/apache2 and the setting APACHE_MODULES doesn't have php5 in the list, you have not enabled PHP.

  3. #3
    tadeas-moravec NNTP User

    Default Re: PHP with Apache

    Hello,
    I have a similar PHP problem.
    I have installed openSuSE 11.0 with LAMP. I changed the web directory and enabled PHP in the HTTP server configuration in Yast and changed

    Code:
    <Directory />
        Options None
        AllowOverride None
        Order deny,allow
        Deny from all
    </Directory>
    to

    Code:
    <Directory />
        Options None
        AllowOverride None
        Order deny,allow
        Allow from all
    </Directory>
    in the httpd.conf - to get access the filesystem.

    The http pages work all-right, but when I try to view a php generated page, I get an error:

    Code:
    An error occurred when loading http://localhost/a.php:
    
    inner server error
    localhost
    It's not a script error, "a.php" is a very simple script:

    Code:
    <?php echo "working?"; ?>
    and no other script work either.

    The PHP module should be properly installed and working:

    Code:
    tadeas:~ # httpd2 -M
    Loaded Modules:
     core_module (static)
     mpm_prefork_module (static)
     http_module (static)
     so_module (static)
     authz_host_module (shared)
     actions_module (shared)
     alias_module (shared)
     auth_basic_module (shared)
     authz_groupfile_module (shared)
     authn_file_module (shared)
     authz_user_module (shared)
     autoindex_module (shared)
     cgi_module (shared)
     dir_module (shared)
     include_module (shared)
     log_config_module (shared)
     mime_module (shared)
     negotiation_module (shared)
     setenvif_module (shared)
     status_module (shared)
     userdir_module (shared)
     asis_module (shared)
     imagemap_module (shared)
     php5_module (shared)
     authz_default_module (shared)
    Syntax OK
    and there is "php5" in APACHE_MODULES in /etc/sysconfig/apache2.

    In mime.types, there is the line
    Code:
    application/x-php php php3 php4 php5
    so it should recognize a php script.

    What could be wrong? If only the Apache wrote WHAT server error occurred, it would be much easier. On openSuSE 10.3 there wasn't any problem like this, everything worked. I didn't upgrade the system from 10.3 to 11.0, I made a new installation, so there shouldn't be any version-related problems.

  4. #4
    Join Date
    Jun 2008
    Location
    /dev/swat
    Posts
    1,181

    Default Re: PHP with Apache

    Mate,i would prefer fresh installation.
    however the stuffs you mentioned in your above post, i did apply all of that. But with no luck.
    For you: did you restarted your PC after doing modification, OR your server.

    About the problem i face that time: i did a fresh install again and install everything from repos. Then start the server, and it worked.
    So now not sure what was the problem.
    But i think in my case there was some mixup file problems.
    Linux[openSUSE, KDE], PHP, MySQL, Wordpress, Tech News, etc :
    http://anl4u.com

  5. #5
    tadeas-moravec NNTP User

    Default Re: PHP with Apache

    Thanks for your reply.
    Maybe I didn't express myself correctly. I mean I did a fresh installation on a formated disc and installed everything from repos.
    Of course I tried restarting Apache and PC after any change, but it didn't help.

    However I have a new idea about where the problem could be, I'll take a look on my keyboard settings and coding. A friend of mine used to have similar problems (C++ application not working due to not known reason) and found out that the problem was in quotes - in my mothertongue we use the first quotes at the bottom of the line. That was what the compiler didn't understand...

  6. #6
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: PHP with Apache

    Apache writes errors into /var/log/apache2/error_log You should look there first.

  7. #7
    surjya NNTP User

    Default Re: PHP with Apache

    Hi,

    The simillar problem is here. I had a fresh LAMP installation on openSuse 11.1. I have chosen LAMP pattern from yast2 software management. I enabled the php5 module after installation. I checked the module is loaded with the command "apache2ctl -M".

    My index.html file opens nicely. But I have problem in opening the .php file in the same folder.

    I checked the error logs :
    error_log
    ----------
    [Sun Aug 23 01:29:05 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
    [Sun Aug 23 01:29:05 2009] [notice] Apache/2.2.10 (Linux/SUSE) mod_ssl/2.2.10 OpenSSL/0.9.8h PHP/5.2.6 with Suhosin-Patch configured -- resumingnormal operations
    [Sun Aug 23 01:57:07 2009] [notice] caught SIGTERM, shutting down
    [Sun Aug 23 01:57:07 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
    [Sun Aug 23 01:57:08 2009] [notice] Apache/2.2.10 (Linux/SUSE) mod_ssl/2.2.10 OpenSSL/0.9.8h PHP/5.2.6 with Suhosin-Patch configured -- resumingnormal operations
    [Sun Aug 23 02:21:01 2009] [notice] caught SIGTERM, shutting down
    [Sun Aug 23 02:21:02 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
    [Sun Aug 23 02:21:02 2009] [notice] Apache/2.2.10 (Linux/SUSE) mod_ssl/2.2.10 OpenSSL/0.9.8h PHP/5.2.6 with Suhosin-Patch configured -- resumingnormal operations
    [Sun Aug 23 02:37:31 2009] [notice] caught SIGTERM, shutting down
    [Sun Aug 23 02:37:32 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
    [Sun Aug 23 02:37:32 2009] [notice] Apache/2.2.10 (Linux/SUSE) mod_ssl/2.2.10 OpenSSL/0.9.8h PHP/5.2.6 with Suhosin-Patch configured -- resumingnormal operations
    [Sun Aug 23 03:55:54 2009] [notice] caught SIGTERM, shutting down
    [Sun Aug 23 03:55:58 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
    [Sun Aug 23 03:55:58 2009] [notice] Apache/2.2.10 (Linux/SUSE) mod_ssl/2.2.10 OpenSSL/0.9.8h PHP/5.2.6 with Suhosin-Patch configured -- resumingnormal operations
    [Sun Aug 23 04:04:48 2009] [notice] caught SIGTERM, shutting down
    [Sun Aug 23 04:04:48 2009] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
    [Sun Aug 23 04:04:49 2009] [notice] Apache/2.2.10 (Linux/SUSE) mod_ssl/2.2.10 OpenSSL/0.9.8h PHP/5.2.6 with Suhosin-Patch configured -- resumingnormal operations
    ~
    ~
    access_log
    ----------
    ::1 - - [23/Aug/2009:04:05:21 +0530] "GET / HTTP/1.1" 200 44 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/2008103100 SUSE/3.0.4-4.6 Firefox/3.0.4"
    ::1 - - [23/Aug/2009:04:05:21 +0530] "GET /favicon.ico HTTP/1.1" 200 302 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/2008103100 SUSE/3.0.4-4.6 Firefox/3.0.4"

    rcapache2.out
    -------------
    Syntax OK

    Thats all. I m stuck very badly. Can anybody give me any break through?

  8. #8
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,686
    Blog Entries
    4

    Default Re: PHP with Apache

    There's no evidence in access_log that you accessed your PHP script or even index.html through the web browser.

    When you say you "opened" index.html and your PHP script, what did you mean? Did you use something like dolphin, which is a file browser? You have to access PHP scripts through the web server with something like:

    http://localhost/~myself/test.php

    to see the results it produces. In a file browser you just see the source code.

    In this case the file test.php should be placed in ~/public_html/test.php.

  9. #9
    Join Date
    Jan 2009
    Location
    Toronto, Ontario
    Posts
    188

    Default Re: PHP with Apache

    surjya wrote:

    >
    > Hi,
    >
    > The simillar problem is here. I had a fresh LAMP installation on
    > openSuse 11.1. I have chosen LAMP pattern from yast2 software
    > management. I enabled the php5 module after installation. I checked the
    > module is loaded with the command "apache2ctl -M".
    >
    > My index.html file opens nicely. But I have problem in opening the .php
    > file in the same folder.
    >
    > I checked the error logs :
    > error_log
    > ----------
    > [Sun Aug 23 01:29:05 2009] [warn] Init: Session Cache is not configured
    > [hint: SSLSessionCache]
    > [Sun Aug 23 01:29:05 2009] [notice] Apache/2.2.10 (Linux/SUSE)
    > mod_ssl/2.2.10 OpenSSL/0.9.8h PHP/5.2.6 with Suhosin-Patch configured --
    > resumingnormal operations
    > [Sun Aug 23 01:57:07 2009] [notice] caught SIGTERM, shutting down
    > [Sun Aug 23 01:57:07 2009] [warn] Init: Session Cache is not configured
    > [hint: SSLSessionCache]
    > [Sun Aug 23 01:57:08 2009] [notice] Apache/2.2.10 (Linux/SUSE)
    > mod_ssl/2.2.10 OpenSSL/0.9.8h PHP/5.2.6 with Suhosin-Patch configured --
    > resumingnormal operations
    > [Sun Aug 23 02:21:01 2009] [notice] caught SIGTERM, shutting down
    > [Sun Aug 23 02:21:02 2009] [warn] Init: Session Cache is not configured
    > [hint: SSLSessionCache]
    > [Sun Aug 23 02:21:02 2009] [notice] Apache/2.2.10 (Linux/SUSE)
    > mod_ssl/2.2.10 OpenSSL/0.9.8h PHP/5.2.6 with Suhosin-Patch configured --
    > resumingnormal operations
    > [Sun Aug 23 02:37:31 2009] [notice] caught SIGTERM, shutting down
    > [Sun Aug 23 02:37:32 2009] [warn] Init: Session Cache is not configured
    > [hint: SSLSessionCache]
    > [Sun Aug 23 02:37:32 2009] [notice] Apache/2.2.10 (Linux/SUSE)
    > mod_ssl/2.2.10 OpenSSL/0.9.8h PHP/5.2.6 with Suhosin-Patch configured --
    > resumingnormal operations
    > [Sun Aug 23 03:55:54 2009] [notice] caught SIGTERM, shutting down
    > [Sun Aug 23 03:55:58 2009] [warn] Init: Session Cache is not configured
    > [hint: SSLSessionCache]
    > [Sun Aug 23 03:55:58 2009] [notice] Apache/2.2.10 (Linux/SUSE)
    > mod_ssl/2.2.10 OpenSSL/0.9.8h PHP/5.2.6 with Suhosin-Patch configured --
    > resumingnormal operations
    > [Sun Aug 23 04:04:48 2009] [notice] caught SIGTERM, shutting down
    > [Sun Aug 23 04:04:48 2009] [warn] Init: Session Cache is not configured
    > [hint: SSLSessionCache]
    > [Sun Aug 23 04:04:49 2009] [notice] Apache/2.2.10 (Linux/SUSE)
    > mod_ssl/2.2.10 OpenSSL/0.9.8h PHP/5.2.6 with Suhosin-Patch configured --
    > resumingnormal operations
    > ~
    > ~
    > access_log
    > ----------
    > ::1 - - [23/Aug/2009:04:05:21 +0530] "GET / HTTP/1.1" 200 44 "-"
    > "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/2008103100
    > SUSE/3.0.4-4.6 Firefox/3.0.4"
    > ::1 - - [23/Aug/2009:04:05:21 +0530] "GET /favicon.ico HTTP/1.1" 200
    > 302 "-" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4)
    > Gecko/2008103100 SUSE/3.0.4-4.6 Firefox/3.0.4"
    >
    > rcapache2.out
    > -------------
    > Syntax OK
    >
    > Thats all. I m stuck very badly. Can anybody give me any break through?
    >
    >

    I once got caught trying to view a php script that I'd put in a file called
    test.html then wondering why the heck I wasn't seeing the result I was
    expecting. Turned out that php was set to only interpret files with
    the .php extension so my test.html wasn't getting run through the
    interpreter at all.

    --
    kev.

  10. #10

    Default Re: PHP with Apache

    I used to have the same problem. Fresh installation as described here, but apache couldn't find php.

    So, the problem was resolved by adding the line into default-server.conf:
    Code:
    Include /etc/apache2/conf.d/php5.conf
    and to restart apache.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •