Do I use php or ssh? If so, please tell me how because I haven't got a clue as to either of them. I'm just a singer who started learning to design one site from the past few months. my site is yummyrestaurants.co.uk.

I read this article on how to create a google sitemap using the google sitemap generator.

Google requires the following if you want to generate google sitemap using google sitemap generator:
* You must be able to connect to and run scripts on your web server.
* Your web server must have Python 2.2 or later installed.
* You must know the command that launches Python. (Generally, this is python, but may vary by installation. For instance, if the web server has two versions of Python installed, the earlier version may be invoked by the command python and the later version may be invoked by the command python2.)
* You must know the directory path to your site. If your web server hosts one site, this may be a path such as var/www/html. If you have a virtual server that hosts multiple sites, this may be a path such as home/virtual/site1/fst/var/www/html.
* You must be able to upload files to your web server (for instance, using FTP).
* If you will be generating a list of URLs based on access logs, you must know the encoding used for those logs and the complete path to them.

My hosting company has python 2.2 installed and said I can run python and php scripts as long as I enable execute permission using ftp. I did that too.

Google mentioned I need to upload the following 3 files to my root directory:

sitemap_ —the python script that generates your Sitemap
config.xml - the template configuration file I'll use to specify the configuration for my site
urllist.txt - the template URL list I can use if I wish to create a Sitemap based on a set of URLs that I specify ( I chose this option as I thought it was the easiest)


In order to run the Sitemap Generator, you’ll need to connect to your web server. The method you use to connect depends on your environment. For instance, you can generally access a UNIX-based server using SSH. For more information on connecting to your web server and running scripts, talk to your web host. - I spoke to my hosting company and they said to use a php file to run the python script (sitemap_).

This is where I'm stuck. I don't know how to create a php file. Then I searched all over Google and found out how to create one.

I tried to run the php file using internet explorer and it would return the following:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log.

Can anyone point me to the right direction?

All I wanted was to create a google friend sitemap and I am determined to follow this way to create one. I realize there are other places where its easy to create xml sitemaps but I believe this is a good way to create a sitemap where I can decide how often googlebot should crawl my site by specifying that in the config.xml file.

Anybody out there who knows what I'm going through and how I can get through this?

yinyang

Dani AI

Generated

A short, practical summary for and : the usual choices are (A) run the sitemap generator from a shell on the host (SSH/CLI) or (B) run it locally and upload the generated sitemap XML to the site root, then submit it to Search Console. Running a command-line Python generator through a browser (via a plain file in webroot) often triggers web-server errors; the simplest, most reliable workflows are CLI or local generation plus upload. Google Search Central: Build and submit a sitemap. (developers.google.com)

If SSH is available, this is the cleanest path: confirm which Python is installed, add a safe shebang, make the script executable, and run it from the shell. Example diagnostics and commands:

ssh user@host
which python
python --version
chmod +x sitemap_gen.py
./sitemap_gen.py   # or: python sitemap_gen.py

Put a shebang like #!/usr/bin/env python3 (or python/python2 only if the host requires it) and ensure UNIX line endings; then check the generated sitemap file. See Python guidance on shebangs and executable scripts. (docs.python.org)

If SSH is not available, a controlled PHP wrapper can invoke the generator, but must use absolute paths, proper escaping, and capture stderr so errors are visible. Example (adjust paths and never pass untrusted input directly):

<?php
$python = '/usr/bin/python';
$script = '/home/username/public_html/sitemap_gen.py';
$cmd = escapeshellcmd("$python $script 2>&1");
exec($cmd, $output, $rc);
echo '<pre>' . htmlspecialchars(implode("\n", $output)) . '</pre>';
?>

Use escapeshellarg/escapeshellcmd and read the PHP manual notes about exec for security and backgrounding. (php.net)

Troubleshooting tips: always inspect the server error log (tail -f the Apache error log) — a 500-type failure usually shows the real cause there. If the script is invoked as a CGI it must emit an HTTP header (for example Content-type: text/plain\n\n) or Apache will report a premature-end-of-headers error; other common causes are wrong file permissions, CRLF line endings, or suexec permission policy. If those are not solvable, generate the sitemap locally and upload it to the site root, then submit the sitemap URL in Search Console or reference it from robots.txt. See Apache CGI debugging and error-log guidance and the robots.txt sitemap directive. (httpd.apache.org)

I also need help trying to run this. I don't know where to start. I created www.<<snip>>. and want it to be indexed. How do I run this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.