How do I start PHP?

I am installing opensuse 11.3 as a text-based web server.

I have installed apache2, php, php-gd, php-pear and mysql…

Now, I am trying to run the installwizard.php to install this LAMP app and any php file, seems to just download, instead of ‘resolve to the screen’ in the browser.

  • When I run chkconfig, and see that apache and mysql are running.
  • I have already restarted apache, and it seems to come up okay.
  • I have created a test index.html file, and seems to be loading fine.
  • I have googled for this, and it doesn’t seem to happen to anyone else!
  • when I try to yum install php, it says that version php5-5.3.2-1.31.i586 is already installed.

I am using yum, on the command line.
Permissions are:

-rwxr-xr-x 1 root root 5654 2008-08-04 16:39 installtest.php
-rwxr-xr-x 1 root root 48605 2008-08-04 16:39 installwizard.php

Any suggestions would be welcome!!!

  • zoomiest

Hi
What about creating a test phpinfo file? You can also use apache2ctl -M to see the loaded modules

Also once you have installed whatever applications your using, MAKE sure you either move or rename any of those setup files otherwise you will be owed before you know it if your system is internet facing. Install something like awstats to keep an eye out or review the logs for 404 entries.

Try using:


php -r 'phpinfo();'

on the command line. See if you get any errors. If this goes fine, check if apache working as expected; try issuing;


exec 3<> /dev/tcp/localhost/80
echo -e "GET
">&3
cat <&3

check if you getting anything. If not, probably your apache is not working as expected.

If this both is fine, it is probably your apache doesn’t know how to open php files with. You need to make required settings. Check if you got this file;

/etc/apache2/conf.d/php5.conf

This is how mine looks like:


<IfModule mod_php5.c>
        AddHandler application/x-httpd-php .php4
        AddHandler application/x-httpd-php .php5
        AddHandler application/x-httpd-php .php
        AddHandler application/x-httpd-php-source .php4s
        AddHandler application/x-httpd-php-source .php5s
        AddHandler application/x-httpd-php-source .phps
        DirectoryIndex index.php4
        DirectoryIndex index.php5
        DirectoryIndex index.php
</IfModule>

And also, you need to have this line


LoadModule php5_module /usr/lib/apache2/mod_php5.so

in the, /etc/apache2/sysconfig.d/loadmodule.conf

On Sat, 05 Feb 2011 02:06:02 +0530, zoomiest
<zoomiest@no-mx.forums.opensuse.org> wrote:

> I have installed apache2, php, php-gd, php-pear and mysql…

do you have apache2-mod_php5 installed? that’s required. then it needs to
be configured to be used, in /etc/sysconfig/apache2 – unless that’s done
during installation, which it wasn’t when i installed apache & co, after
every new install.


phani.

On 02/04/2011 09:36 PM, zoomiest wrote:
> I am using yum, on the command line.

you installed yum on openSUSE??

cool, i didn’t know that was possible…

by the way, you said you have a “text-based web server” what does that
mean? to me it means you do everything at the command line and there
is no X server installed…so, when you write “‘resolve to the screen’
in the browser” are you using lynx, links or what?

or, are you looking in a browser on another machine, networked to the
server…

sorry if that is a stupid question.


DenverD
CAVEAT: http://is.gd/bpoMD
[NNTP posted w/openSUSE 11.3, KDE4.5.5, Thunderbird3.0.11, nVidia
173.14.28 3D, Athlon 64 3000+]
“It is far easier to read, understand and follow the instructions than
to undo the problems caused by not.” DD 23 Jan 11

Why oh why are you running Yum on OpenSuse??

Thank you Malcolm.
apache2ctl -M was helpful. php was not loading… will continue my sleuthing.
BTW, I installed webalizer at your suggestion (awstats wasn’t in the repository… is awstats better?)

Thank you phani.
apache2-mod_php5 was NOT installed, so I installed it.

in the /sysconfig/apache2 file, I saw that php5 was included in the apache modules… is this good then?

APACHE_MODULES=“actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user autoindex cgi dir env expires include log_config mime negotiation setenvif ssl userdir php5”

DenverD, …never a stupid question.
Yes, there is no X server - just command line.
Yes, I always install lynx.

This is just a webserver, working out of my basement, hosting an app that I need for work, and being that I am a fanatic for this Linux stuff, I always wanted to do everything command line (allows me to work from anywhere…)

When I ran that 3-line code, I got the parsing of my index.html file that I was using to test if apache was working. So, that must be fine.

When I looked at my /etc/apache2/conf.d/php5.conf I got

cats:/etc/apache2/conf.d # cat php5.conf
<IfModule mod_php5.c>
AddHandler application/x-httpd-php .php4
AddHandler application/x-httpd-php .php5
AddHandler application/x-httpd-php .php
AddHandler application/x-httpd-php-source .php4s
AddHandler application/x-httpd-php-source .php5s
AddHandler application/x-httpd-php-source .phps
DirectoryIndex index.php4
DirectoryIndex index.php5
DirectoryIndex index.php
</IfModule>

Also, I do have the LoadModule… mod_php5.so in my loadmodule.conf file. Its at the bottom. So, must have been included when I installed apache2-mod_php5…

Thanks all. let me restart a few things, and get these additions active…

On Sat, 05 Feb 2011 19:36:02 +0530, zoomiest
<zoomiest@no-mx.forums.opensuse.org> wrote:

> apache2-mod_php5 was NOT installed, so I installed it.

that should help, unless something else is missing…

> in the /sysconfig/apache2 file, I saw that php5 was included in the
> apache modules… is this good then?

yes, that’s good. you are sure, of course, that you didn’t find the quote
below in one of the commented-out sets of included modules that this file
contains? i found this pretty confusing, lots of different configurations
in the same file, but most of them commented out, just to show how to do
things.

>> APACHE_MODULES=“actions alias auth_basic authn_file authz_host
>> authz_groupfile authz_default authz_user autoindex cgi dir env expires
>> include log_config mime negotiation setenvif ssl userdir php5”

that should work, IMO.


phani.

On 02/05/2011 03:06 PM, zoomiest wrote:

> Yes, there is no X server - just command line.
> Yes, I always install lynx.

COOL!!!

(i asked because we do get folks here (often) who are a little
‘confused’ and [having grown up in a Redmond Universe] ask questions
from an entirely different ‘place’!)


DenverD
CAVEAT: http://is.gd/bpoMD
[NNTP posted w/openSUSE 11.3, KDE4.5.5, Thunderbird3.0.11, nVidia
173.14.28 3D, Athlon 64 3000+]
“It is far easier to read, understand and follow the instructions than
to undo the problems caused by not.” DD 23 Jan 11

Status - I was able to get my info.php file to load, showing all php extensions, etc. So, I now, have php running! Thank you all. I learned some things.

However my installwizard.php file still won’t execute in Chrome (but it DID in Firefox… ? weird!)

So, I am off and running, to get this going. Thank you all!

(if you know why the browser matters, please let me know!)

It might be some kind of Chrome bug, but you need to include more details about the problem I guess. What do you get when you try yo execute it on the Chrome?