I've installed apache server and php5 on linux, but am not able to get a simple php file executed and shown in browser. What I see in browser is this:
<?php echo 'hello';?>
Why is the php code not executed?
Here is the content of /etc/apache2/sites-available/default
file:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/public
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
<Directory /var/www/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride All
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
And I have place my test php file in /var/www/public
Consider these:
Well you have the container missing for one,, here is a conditional with the echo call back.
if($result) {
echo "success";
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.