I’m trying to use PHP 7
When I use the address localhost/index.php in FIREFOX the index.php file is not being executed.
How do I solve this problem?
Thanks in advance
I’m trying to use PHP 7
When I use the address localhost/index.php in FIREFOX the index.php file is not being executed.
How do I solve this problem?
Thanks in advance
This has nothing to do with Firefox. HTTP browsers do not execute PHP files. The server program does (or at least should do it).
You do not tell what server program you use, I assume Apache. What did you do to let Apache execute PHP files?
I execute the command bellow to let Apache run PHP files
service apache2 start
After this command, the address localhost/index.html works.
But localhost/index.php does not work
I have a machine openSUSE 13.2 and his Firefox opens the localhost/index.php address
I checked the settings of /etc/apache2, they are absolutely identical on both machines.
In addition
The code below shows only text html
The text in php not appear only appear the html code
<html>
Bellow the echo php
<?php
echo "xxxxxxxxxxxxxxxx";
phpinfo();
?>
<br>Above the echo php
</html>
Apache does not handle PHP by default.
I run openSUSE 31.1, Apache and PHP5.
In my default-server.conf I have
Include /etc/apache2/conf.d/*.conf
and in /etc/apache2/conf.d I have
boven:/etc/apache2 # ls -l conf.d
total 16
-rw-r--r-- 1 root root 646 Oct 9 2015 manual.conf
-rw-r--r-- 1 root root 344 Oct 9 2015 mod_cgid-timeout.conf
-rw-r--r-- 1 root root 694 Jun 1 2015 mod_perl.conf
-rw-r--r-- 1 root root 354 Sep 17 2015 php5.conf
boven:/etc/apache2 #
Thus that php5.conf is added to the Apache configuration. You can of course include it directly (not using the wild card construct that includes more then one file) and of course you need a corresponding PHP7 file (which may already be there when you installed PHP7 from an openSUSE repo).
In any case you have to do something similar to tell Apache how to handle files with a .php suffix.
I did your instructions but not work.
I have a machine with opensuse 13.2 and, Firefox is running PHP files
For lack of options, I copied the /apache2 folder from the 13.2 machine to machine LEAP
I restarted all
But the problem remains
When Firefox opens the address localhost/index.html, it shows only the html content, nothing that is in PHP appears
No one else has this problem with PHP7 and LEAP???
I did not give instructions. I showed you what I have in another version to communicate to you where you should look. Doing exactly what I showed will not work. E.g. how do you think that adding a php5.conf file (of which I btw did not give you the contents) can make a php7 environment working?
And I repeat: It is NOT Fiirefox that is doing things (or not). It is Apache.
First, it should be noted that PHP code is not much different than many other scripting code that is often used as webserver code, it can also be run without a webserver although not seen that way often. The following reference is for those who are interested in this rare implementation
http://www.php.net/manual/en/features.commandline.introduction.php
Most people though will run PHP as server-side code within webpages served by a webserver. Assuming this Forum thread is about this common implementation…
The first step that should have been asked was whether PHP was properly installed into Apache.
Was Apache and PHP set up using the LAMP pattern? Installed separately using YAST or zypper? Some other way?
From here on, I’m assuming a default openSUSE Apache installation.
The next step (which can still be executed) is to run a PHP test page.
To do this,
Rename/move your existing index.html page to disable it. Run the following in a root console. An existing default index.html may display instead of a php page
mv /srv/www/htdocs/index.html /srv/www/htdocs/index.html.bak
Now create a new index.php file in that location with the following content
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html>
Now, start or restart your Apache webserver. The following does this
systemctl restart apache2.service
Now you can open a web browser to “http://localhost” and see if “Hello World” displays or you see an error.
If nothing displays, you can explicitly request the page “http://localhost/index.php” if that file name isn’t in the list of default pages.
TSU