-
1. Re: Problems building sample 3 tier application
DougBaer Apr 10, 2018 9:02 AM (in response to drharrold)Hi Dave,
The first pointer I'd have is to stick with the v1.0 build that I used in the article. If you're going to try and follow it step by step, all of that works. You can still download this version at the bottom of the PhotonOS download page: Downloading Photon OS · vmware/photon Wiki · GitHub in the "PhotonOS Original Binaries section"
This is the link to the version I used for the article:
https://bintray.com/vmware/photon/download_file?file_path=photon-custom-hw10-1.0-13c08b6.ova
As for the issue you are seeing, it looks to me like Python is not being executed by the CGI module, which is the "misconfiguration" being reported. It is possible that Python is not installed, or is not in the path.
It looks like I'm going to need to look at the Photon 2.x release. I'll take a quick look to see what I can find, but I need to download the new version, so it may take me a bit.
Thanks for using the HOL blog and that article
-Doug
-
2. Re: Problems building sample 3 tier application
DougBaer Apr 10, 2018 10:07 AM (in response to drharrold)It looks like you may make some headway by replacing the
/usr/bin/env python
line at the top of the python scropt(s) with
/usr/bin/env python3
It looks like they have replaced python 2.x with 3.x in v2.0 of PhotonOS.
Because it is Python 3.x now, you also need to put all of the "print" parameters in parentheses. So, for example,
#!/usr/bin/env python3
import cgi
import sqlite3
conn=sqlite3.connect('/etc/httpd/db/clients.db')
curs=conn.cursor()
print ("Content-type:text/plain\n\n");
form = cgi.FieldStorage()
querystring = form.getvalue("querystring")
if querystring != None:
queryval = "%" + querystring + "%"
select = "SELECT * FROM clients WHERE name LIKE '" + queryval + "'"
else:
select = "SELECT * FROM clients"
for row in curs.execute(select):
if len(row) == 4:
for item in row:
print (item,'|')
print ("#")
conn.close()
Let me know if that works out for you
-Doug
-
3. Re: Problems building sample 3 tier application
drharrold Apr 10, 2018 10:08 AM (in response to DougBaer)Thanks Doug,
I downloaded the 1.0 version and everything went as you documented in the article.
I was just trying to be current/bleeding edge with using V2.0, I didn't think some of those things would have changed so much.
And, Thanks You!!! for publishing these. The app will be really handy as I build my lab to demo NSX to customers.
Thanks again!
Dave
-
4. Re: Problems building sample 3 tier application
drharrold Apr 10, 2018 10:10 AM (in response to DougBaer)OK, thanks for the pointer.
I'm going to continue down the path of using the Photon 1.0 stuff, just because I need something quick.
I'll probably look at updating the Photon 2.0 stuff when I have a little more time.
Thanks for the great work!
-
5. Re: Problems building sample 3 tier application
drharrold Apr 10, 2018 12:31 PM (in response to DougBaer)I got the db server working on Photon 2.0
1.) Had to install sqlite
2.) Made the python changes you highlighted below
3.) Changes to httpd.conf file
This is how the cgi section of the httpd.conf file looks.
<IfModule !mpm_prefork_module>
#LoadModule cgid_module /usr/lib/httpd/modules/mod_cgid.so
</IfModule>
<IfModule mpm_prefork_module>
#LoadModule cgi_module /usr/lib/httpd/modules/mod_cgi.so
</IfModule>
If I just uncommented the LoadModule line for the mod_cgi.so file, it still gave the error. I had to comment out all of the IfModule statements and then it worked.
#<IfModule !mpm_prefork_module>
#LoadModule cgid_module /usr/lib/httpd/modules/mod_cgid.so
#</IfModule>
#<IfModule mpm_prefork_module>
LoadModule cgi_module /usr/lib/httpd/modules/mod_cgi.so
#</IfModule>
So, I expect I'll have to make similar changes on the app and web server VMs.
I'll update when those are working.
Dave
-
6. Re: Problems building sample 3 tier application
drharrold Apr 12, 2018 8:59 AM (in response to drharrold)So I finished building the app and web server VMs with Photon 2.0. The only updates needed were the changes to the Python scripts similar to the db VM: Change the environment to python3, update the print commands.
So, it's all working using the PhotonOS 2.0 OVAs.
Thanks,
Dave
-
7. Re: Problems building sample 3 tier application
DougBaer Apr 12, 2018 9:01 AM (in response to drharrold)Excellent! Nice job and thanks for the update.
-Doug