So I installed Php70* on my amazon Linux Server, and have apache (httpd) installed and when i go to view the php page on my browser, it downloads the php file instead of showing on the browser.
I tried different browsers, clearing the cache, checking the permissions to my php files and the error perists.
here is what I have on my system hope it helps; Anything else I could be missing? Any help is appreciated.
(i have a simple php file called "phpinfo.php" and in it is
on my ec2 instance at the terminal i can successfully do php phpinfo.php
php -v
PHP 7.0.14 (cli) (built: Jan 18 2017 19:13:23) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.14, Copyright (c) 1999-2016, by Zend Technologies
httpd -v
Server version: Apache/2.4.25 (Amazon)
Server built: Jan 19 2017 16:55:49
I got all php70 packages installed:
sudo yum list installed php70*
Loaded plugins: priorities, update-motd, upgrade-helper
Installed Packages
php70.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-bcmath.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-cli.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-common.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-dba.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-dbg.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-devel.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-embedded.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-enchant.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-fpm.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-gd.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-gmp.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-imap.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-intl.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-json.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-ldap.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-mbstring.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-mcrypt.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-mysqlnd.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-odbc.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-opcache.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-pdo.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-pdo-dblib.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-pecl-apcu.x86_64 5.1.5-2.2.amzn1 @amzn-main
php70-pecl-apcu-devel.x86_64 5.1.5-2.2.amzn1 @amzn-main
php70-pecl-igbinary.x86_64 1.2.2-0.1.20151217git2b7c703.5.amzn1 @amzn-main
php70-pecl-igbinary-devel.x86_64
1.2.2-0.1.20151217git2b7c703.5.amzn1 @amzn-main
php70-pecl-imagick.x86_64 3.4.2-1.4.amzn1 @amzn-main
php70-pecl-imagick-devel.x86_64
3.4.2-1.4.amzn1 @amzn-main
php70-pecl-memcache.x86_64 3.0.9-0.4.20160311git4991c2f.8.amzn1 @amzn-main
php70-pecl-memcached.x86_64 3.0.0-0.1.20160217git6ace07d.2.amzn1 @amzn-main
php70-pecl-oauth.x86_64 2.0.2-1.2.amzn1 @amzn-main
php70-pecl-ssh2.x86_64 1.0-5.16.amzn1 @amzn-main
php70-pecl-uuid.x86_64 1.0.4-7.1.amzn1 @amzn-main
php70-pecl-yaml.x86_64 2.0.0-1RC8.3.amzn1 @amzn-main
php70-pgsql.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-process.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-pspell.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-recode.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-snmp.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-soap.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-tidy.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-xml.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-xmlrpc.x86_64 7.0.14-1.20.amzn1 @amzn-updates
php70-zip.x86_64 7.0.14-1.20.amzn1 @amzn-updates
I saw people mentioning to change the /etc/httpd/conf/httpd.conf file to include addtype/handler so here is what I have:
grep -n "php" /etc/httpd/conf/httpd.conf
54:LoadModule php7_module modules/libphp-7.0.so
163: DirectoryIndex index.html index.php
175: SetHandler application/x-httpd-php
287: AddType application/x-httpd-php .php
288: AddType application/x-httpd-php-source .phps
301: AddHandler php7-script .php
302: AddHandler application/x-httpd-php .phps
303: AddHandler application/x-httpd-php .php
I also have the short_open_tags=on just in case:
grep short_open_tag php-7.0.ini
; short_open_tag
short_open_tag = On
grep short_open_tag php.ini
; short_open_tag
short_open_tag = On