To verify that php is properly working, create a index.php file into the /srv/www/htdocs/ folder with the following content:
<?php
phpinfo();
?>
and point your browser to '[localhost/index.php](http://localhost/index.php)'. You should see a page containing a table with all php settings displayed.
… but when i follow that instruction the index.php file just gets downloaded to my Downloads directory.
I take it that means php has not been installed???
Although i followed instructions closely … i was a bit surprised at the response to ‘a2enmod php7’
And, FWIW: I find you root prompt very confusing, due to missing # at the end.
Did you install the LAMP server pattern? Did you use YaST’s HTTP server module to set things up, or did you do a manual setup?
I have just started a few days ago getting LAMP going on a Leap 15 (based on what I have running on a 13.1.
I also have the php7 in that list (but I do not know how it got there). As far as I can remember, I just tried the index.php test and it worked.
Thing is that I copied the default-server-conf from one system to the other, but there is no specific php7 statement there. Also I used the YaST module, which has a list of apache modules (also php5), but not php7. To me it looked as if it was all autmagical.
There being reasonable doubt that PHP7 is running in the OP’s system, I am reluctant to go for the simple question: please show the ownership and permissions of your index.php. Because the following the instruction to create it does not mean that it is done correct.
May have nothing to do with your problem, but when PHP is not called by Apache to do it’s job, I expect the contents of the script to be displayed in the browser window. But you say that it was stored in your Dowload directory. That would be rather intrusive >:(
Given the apache changes between 13.1 and Leap 15, and your copying over the defaults, I doubt whether the references are the same.
May have nothing to do with your problem, but when PHP is not called by Apache to do it’s job, I expect the contents of the script to be displayed in the browser window. But you say that it was stored in your Dowload directory. That would be rather intrusive >:(
This simply happens when the php# module is not loaded when apache starts. Apache considers it just being another downloadable file, which by default goes in ~/Downloads
I do not know which references you mean, but the only thing I changed is the access parameters from something like
Order deny,allow
Deny from all
to the new concept. Not to difficult if you know about it (and I did already for some time).
The big challenge is the PHP to MySQL interface that chahged complete.
Apache only gives it a MIME type. It is the browser that decides if that MIME type is something it can and will display, or something that the user might want to store in a file. The browser then has probably ~/Download as a default place for that, but if is that really something that then happens without the user acknowledging that? Maybe the browser can be configured to store in ~/Downloads without user interaction, but that is not the default IMHO.
BTW I have seen reports here where in a similar cases (PHP files that were not interpreted as such because the PHP module wasn’t loaded) the php script contents was shown by the browser. Probably because Apache send it down with MIMe type text.
Sure … here is the listing at /srv/www/htdocs/
Being owned by root … might be the issue? But i had to be logged on as root to create it … and i did subsequently log on as root and still the php would not run.?
[root@fssd-OS423 htdocs]# ls -al
total 24K
drwxr-xr-x 3 root root 4.0K Oct 6 01:43 **.**
drwxr-xr-x 5 root root 4.0K May 10 2017 **..**
drwxr-xr-x 2 root root 4.0K May 16 23:48 **gif**
-rw-r--r-- 1 root root 58 Oct 5 19:44 index.html
-rw-r--r-- 1 root root 22 Oct 5 19:48 index.php
-rw-r--r-- 1 root root 2.4K Aug 7 2017 info2html.css
You’re right, yet I’d like to see what happens if these files were chowned to wwwrun:www ( I know f.e. Nextcloud doesn’t like it if files don’t have this ownership. Don’t know it this is an apache or Nextcloud thing though.
I do not have them (in /srv/www) owned by root nor by wwwrun but by another user that has www as primary group. They are readable for the group (www) and all is fine(.html, .cgi and .php),
I also have other places (using Alias) in the home directory of other user(s) (not members of www) and as long as those files are world readable, all is fine.
erlangen:~ # grep APACHE_MODULES /etc/sysconfig/apache2
# * In the APACHE_MODULES variable, you can use mod_xyz or just xyz syntax.
# APACHE_MODULES="authz_host alias auth dir log_config mime setenvif"
# APACHE_MODULES="authz_host actions alias asis auth autoindex cgi dir imap include log_config mime negotiation setenvif status userdir"
APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_core authz_user autoindex cgi dir env expires include log_config mime negotiation setenvif ssl socache_shmcb userdir reqtimeout authn_core php7"
erlangen:~ #