my php codes cant be read and browser download index.php

Post your questions about Web Server usage and Apache + PHP + MySQL/SQLite web applications.
Post Reply
moodi00851
New here
Posts: 3
Joined: Mon Oct 25, 2021 8:46 pm

my php codes cant be read and browser download index.php

Post by moodi00851 »

hello
I faced with a issue with my web server.
my nas model is TS-963 \
im working on single page web project that includes php codes and whenever i want to check it on nas server , my browser download my index.php and when i change it to .html it can not read the php code.
surely web server is working and apache.cofi is as it should be
Thanks for help
any kind of help will be appreciated.
User avatar
Toxic17
Ask me anything
Posts: 6469
Joined: Tue Jan 25, 2011 11:41 pm
Location: Planet Earth
Contact:

Re: my php codes cant be read and browser download index.php

Post by Toxic17 »

this is more of an apache issue and can be fixed using .htaccess file in the root of your webserver folder.

google it.

https://stackoverflow.com/questions/184 ... aying-them

built in webserver is somewhat loocked down so some commands and code in php.ini etc wont work. you should be able to use .htaccess for most. if you want a full Apache/php server then use Stephane's Apache 7.4 or Apache8.0 qpkgs.

viewtopic.php?f=320&t=151456

viewtopic.php?f=320&t=158250
Regards Simon

Qnap Downloads
MyQNap.Org Repository
Submit a ticket • QNAP Helpdesk
QNAP Tutorials, User Manuals, FAQs, Downloads, Wiki
When you ask a question, please include the following


NAS: TS-673A QuTS hero h5.1.2.2534 • TS-121 4.3.3.2420 • APC Back-UPS ES 700G
Network: VM Hub3: 500/50 • UniFi UDM Pro: 3.2.9 • UniFi Network Controller: 8.0.28
USW-Aggregation: 6.6.61 • US-16-150W: 6.6.61 • 2x USW Mini Flex 2.0.0 • UniFi AC Pro 6.6.62 • UniFi U6-LR 6.6.62
UniFi Protect: 2.11.21/8TB Skyhawk AI • 3x G3 Instants: 4.69.55 • UniFi G3 Flex: 4.69.55 • UniFi G5 Flex: 4.69.55
moodi00851
New here
Posts: 3
Joined: Mon Oct 25, 2021 8:46 pm

Re: my php codes cant be read and browser download index.php

Post by moodi00851 »

Toxic17 wrote: Tue Oct 26, 2021 5:12 pm this is more of an apache issue and can be fixed using .htaccess file in the root of your webserver folder.

google it.

https://stackoverflow.com/questions/184 ... aying-them
I checked this page and copy all i need . its should be on my htaccess file right ?
and nothing changed
by the way, thanks
User avatar
Toxic17
Ask me anything
Posts: 6469
Joined: Tue Jan 25, 2011 11:41 pm
Location: Planet Earth
Contact:

Re: my php codes cant be read and browser download index.php

Post by Toxic17 »

htaccess is a classed as a hidden file, name it ".htaccess"

the dot before the name is needed and no file extension. it should work but depends on your html/php coding of your web pages as well.
Regards Simon

Qnap Downloads
MyQNap.Org Repository
Submit a ticket • QNAP Helpdesk
QNAP Tutorials, User Manuals, FAQs, Downloads, Wiki
When you ask a question, please include the following


NAS: TS-673A QuTS hero h5.1.2.2534 • TS-121 4.3.3.2420 • APC Back-UPS ES 700G
Network: VM Hub3: 500/50 • UniFi UDM Pro: 3.2.9 • UniFi Network Controller: 8.0.28
USW-Aggregation: 6.6.61 • US-16-150W: 6.6.61 • 2x USW Mini Flex 2.0.0 • UniFi AC Pro 6.6.62 • UniFi U6-LR 6.6.62
UniFi Protect: 2.11.21/8TB Skyhawk AI • 3x G3 Instants: 4.69.55 • UniFi G3 Flex: 4.69.55 • UniFi G5 Flex: 4.69.55
moodi00851
New here
Posts: 3
Joined: Mon Oct 25, 2021 8:46 pm

Re: my php codes cant be read and browser download index.php

Post by moodi00851 »

Toxic17 wrote: Wed Oct 27, 2021 6:25 pm htaccess is a classed as a hidden file, name it ".htaccess"

the dot before the name is needed and no file extension. it should work but depends on your html/php coding of your web pages as well.
yes i did the same for htaccess and the code is correct cause i started simple.
i think it can be cause of rewrite-mode in htaccess
Post Reply

Return to “Web Server & Applications (Apache + PHP + MySQL / SQLite)”