Home ] [ Up ] [ Astro123 ] [ Vocation ] [ AstroWin ] [ Election Helper ] [ SE_Aspectarian ] [ MatchMkr ] [ ProgTran ] [ Transits ] [ Midpoint ]

PHP Scripts for Astrology Websites


My basic philosophy is this:

Do not charge people for something they can get for free elsewhere - that would not be fair to them.

Try to use whatever I have so that the most people can benefit from it.

Don't sell any of my free interpretations or reports because people can get them for free at my website.

Make people aware of my website so they may take advantage of all the tools I have there.

Common sense, practicality, and kindness should prevail.

We should never try to take advantage of others, only try to help them.

If people want to make donations to you or anyone else, then they should be free to do so ("Give as the heart dictates and the means permit").

Regarding use of the Swiss Ephemeris: all distribution of parts of the Swiss Ephemeris for programming purposes is subject to the license conditions of the Swiss Ephemeris (which may be found here: https://www.astro.com/swisseph/swephinfo_e.htm). Swiss Ephemeris readme file. Swiss Ephemeris Licence file.


New on 22 June 2021 - Download master_wheel.zip in order to get some ideas on how to program a graphic chartwheel and fit all the various planetary glyphs within the wheel and not have them overlap or cover each other. This set of scripts includes the file named "natal_wheel.php" in which you can modify the variable named '$max_num_pl_in_each_house' to set the maximum number of glyphs in each house (use 7 or 8). You can also change other settings in this file, such as font sizes. Click here to see 7 glyphs max. Click here to see 8 glyphs max. Of course, there are other ways to approach this problem - "many roads lead to Rome" - but perhaps this can get you started.

There is a file named "birth_data.php" in which you can define various birth details and choose which one to view. Set the variable '$bi' at the top of the file to select one of your birth data entries. I can run "index.php" on my Windows computer using either NuSphere's PhpED development system or ZZEE's "PHP GUI 3.1.0". You can also run this on your local XAMPP server or on your Linux server (if you do this, remember to CHMOD the "swetest" file - not "swetest.exe" - to 755).

BTW, within the set of scripts above are two files named "natal_wheel - does not use $indexy.php" and "natal_wheel - 640x640 wheel.php". These files may be explored for other variations. To use these files, just rename them to "natal_wheel.php" (after saving the original "natal_wheel.php" file so you can go back to it).

New on 11 May 2021 - Download php_gn_natal_public_scripts.zip in order to be able to generate natal charts for individuals. This script is almost identical to what is found at: https://astrowin.org/php_gn/natal/index.php. This set of scripts includes part of the Olson time zone database. Download this pdf file which gives you all the instructions for how to set up this set of PHP scripts.

1) - AE_astrology_public_v100.zip - not running properly on Windows 11, so I am removing it for now.

2) - updated on 05 June 2021) Download website_database_scripts_with_atlas.zip in order to be able to set up a website that allows users to create and maintain their own personal database of data records so they may analyze many different types of astrological charts, including natal charts and reports, synastry charts including dual cosmodyne calculations, natal cosmodynes, solar arcs, progressions, solar and lunar returns, planetary hours, vocational analysis, composite charts, contest charts (horary and time of event), Davison relationship charts, transit charts and reports, horary charts, and Moon aspects along with void-of-course data. This set of scripts requires you to set up a MySQLi database and is the same set of scripts used on my website at: http://www.astrowin.org/online_calcs_db/signup_login.php (except for the synastry interpretations, which I do not yet have permission to include in this package of scripts). This set of scripts includes the Olson timezone database. Download this pdf file which gives you all the instructions for how to set up this database and its associated PHP scripts.

3) Download transits_form.zip in order to be able to set up a website that allows your users to see the transit planet aspects to their natal planets for any day. This set of scripts includes transit interpretations as well as the beginning, exact, and ending times for each aspect (within 8 days either side of the set transit date). This script does not contain an atlas to inform users about geographical longitude and latitude or historical time zone - this information must be supplied manually. Download sample output.

4) Download synastry_scripts.zip in order to be able to set up a website that allows your users to calculate and display synastry charts, aspect grids, and an interaspect listing. There are no interpretations provided and the dual cosmodyne calculations are not yet available in this script. Download sample output.

5) Download PDF_natal_reports_PHP_files.zip in order to be able to set up a website that allows your users to generate natal chart reports in PDF format. This script does not contain an atlas to inform users about geographical longitude and latitude or historical time zone - this information must be supplied manually.

6) Download natal_cosmodynes.zip in order to calculate and display natal cosmodynes. You will have to modify the "natal_cosmodynes.php" script because right now it only does a single natal chart (mine). Modify this script in whatever ways you need in order to get what you want to achieve. Add an input form or whatever - the code for calculating natal cosmodynes according to the methods of Elbert Benjamine is all there.

7) Download php_astrology_scripts.zip in order to be able to set up a website like what you can see here: click me (there is no "Right now where you are connecting from" script as that requires a large database). These scripts really replace the below - and there are more of them, and the graphics are much improved.

8) Download transits_PHP_files.zip in order to be able to set up a website that allows your users to generate and read their daily transit interpretations.

9) Download right_now_PHP_files.zip in order to be able to set up a website that allows your users to see the planetary positions RIGHT NOW.


How to set up an astrological website using Allen Edwall's PHP scripts and the Swiss Ephemeris

1. First, you must have a web hosting service that provides you with a website that runs Linux and PHP (make sure the PHP GD graphics library is installed AND THAT THE FREE TYPE LIBRARY IS INSTALLED). Note: in order to run the Swiss ephemeris on Windows, you must use a Windows file called swetest.exe instead of the file named swetest. swetest.exe is not included in the script packages themselves, but you can click here to download it (copy swetest.exe and all the .se1 files into the same folder where your .php scripts are located). I do not recommend using a Windows server - there are issues with the PHP command mktime, among other things. Also, Windows does not run calculations very quickly using the Swiss ephemeris program swetest.exe - I wrote my own simple .dll file to do things much, much faster.

2. Take your downloaded .zip file and unzip it in a local directory. Using your FTP program, create the following sub-directory on your website's server:

   * for 7) above, /public_html/astrology_scripts and /public_html/astrology_scripts/sweph and /public_html/astrology_scripts/natal_files and /public_html/astrology_scripts/transit_files

   * for 8) above, /public_html/transits

   * for 9) above, /public_html/Now

3. Upload the unzipped files to your website in the corresponding and respective directories. After that, CHMOD the file called swetest to 755 in the root directory you created (/public_html/astrology_scripts/sweph OR /public_html/transits OR /public_html/Now).

4. To test your website, visit www.yourdomain.com/astrology_scripts OR www.yourdomain.com/natal_reports OR www.yourdomain.com/transits OR www.yourdomain.com/Now

5. If you get 0.0 degrees for all planets, then either you did not upload swetest using binary mode or you did not CHMOD swetest to 755 or your webserver is not allowing you to execute the file called swetest. If the latter, you will have to ask your web host why swetest cannot run properly (or change web hosts).

6. Be sure to upload the file called swetest in BINARY mode, not ASCII mode nor AUTO mode.

7. If the graphics do not display properly you may have to replace every instance of sserife.fon with arial.ttf due to a bug in later versions of the FreeType library.

8. If your graphics do not work as expected, try replacing all instances of 'arial.ttf with dirname(__FILE__) . '/arial.ttf and 'HamburgSymbols.ttf with dirname(__FILE__) . '/HamburgSymbols.ttf.

9. Depending upon what version of PHP your server is running, you may need to change the current "Function safeEscapeString($string)" code (in all scripts where it is defined). Your PHP version may no longer accept the "mysql_real_escape_string" command. Write me if you need help.


Click here to see a natal chart report in PDF format

Click here to see what the NOW page looks like (old-style graphics)

Click here to see what the NOW page looks like (Style 1 wheel)



last updated - 08 December 2023
Allen Edwall

All programs copyrighted