joshcase / code-blue-admitme

A simple web interface for generating admission notes as if they were to fit straight into a patient’s paper chart.
1 stars 0 forks source link

PHP functionality not working on live site #3

Open HaotianHuang opened 3 years ago

HaotianHuang commented 3 years ago

Hi @joshcase and community,

Just finished admitme and uploading the site files to Cyberduck; it looks normal but I'm having some trouble understanding why the PHP doesn't seem to function on the live site accessible at "haotianhuang.xyz".

Expected behaviour
 After filling in the form and pressing the "Generate Admission Note" button, user is presented with a custom admission note based on entries in index.php.

Actual behaviour 
After filling in the form and pressing the "Generate Admission Note" button, user is presented with a blank admission note with nothing filled in.

View Code Don't know how to show you the code on the actual site but I have created a repository you can view here.

Please note that admitme functions perfectly when I access it locally via "localhost/admitme".

System information 
macOS Big Sur Version 1.1
 Chrome Version 88.0.4324.150 (Official Build) (arm64)
 Cyberduck Version 7.8.2

joshcase commented 3 years ago

Hi @HaotianHuang, great to see you're making really good progress through the book.

Normally problems like this are because PHP is not correctly installed on the server you've installed the website on.

If you can get command line access to your server, runphp -v and share the output.

I do note that when I look at your deployed site, all of your PHP tags are commented out:

Screen Shot 2021-02-08 at 2 12 58 pm

I suspect this is some sort of compensatory thing done by your webhost if PHP is not installed. Who are you hosting your website with?

Josh

HaotianHuang commented 3 years ago

Thanks for the help Josh. It seems PHP was not installed properly despite me running the commands on p166-168. However, I had a dig around and found a solution, the site is now functioning as intended.

For future reference, here are the commands I ran on the console of the server to install PHP (source).

$ sudo apt install php libapache2-mod-php php-mysql $ sudo systemctl restart apache2

Server information DigitalOcean debian-s-1vcpu-1gb-sgp1-01

joshcase commented 3 years ago

Great work @HaotianHuang. This is a great example of one of those problems I describe at the start of the book... No-one can necessarily anticipate them well in advance. And that's why diagnosing and fixing these problems is one of the most valuable skills a developer can have. Keep it up!

Josh