Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7551699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:33:48+00:00 2026-05-30T10:33:48+00:00

I have downloaded a free astrology script in PHP. The script receives some data

  • 0

I have downloaded a free astrology script in PHP. The script receives some data through a form (birth date and time, longitude, latitude etc) and then runs this command with its parameters passed by variables:

exec ("swetest -edir$sweph -b$utdatenow -ut$utnow -p0123456789DAttt -eswe -house$my_longitude,$my_latitude,$h_sys -flsj -g, -head", $out);

The ‘swetest’ file which is an executable for Linux is in the directory: ‘sweph’ located at the root of the site together with some other binary files with data. These binary files are the ‘Swiss Ephemeris’ which determines the position of the planets in a hor-oscope wheel.
The output of this command ($out) is then stored in variables, some more calcula-tions are performed, and finally, the horoscope wheel is generated by the GD library.

In my desktop I run windows and XAMP and my remote server is Linux. I have set the PHP version of my host to 5.3.something.

I have uploaded the script to my host exactly as downloaded (on its own without Code Igniter) following the instructions provided and it runs perfectly without a problem. Which means my host is configured appropriately to run the exe() com-mand.

Now I tried to adapt this script to CodeIgniter.
I placed the binaries in http://example.com/codeIgniterSite/assets/sweph . The first parameter of the “swetest” command is –edir which determines the location of the binaries and I have set it to ‘assets/sweph’ (I have set base href=’http://example.com/codeignitersite’ at the tag of the page).
I have checked the values passed to the parameters ($utnow, $my_latitude, etc) and they are valid.
The problem is that Code Igniter environment ignores the exec command and the $out variable is left empty. The page is then filled with errors as the calculations af-ter the exec() command are carried out without the variables being set properly.

The first error though has to do with the command:

$swephsrc = ‘assets/sweph’;
putenv("PATH=$PATH:$swephsrc")

of the script placed above the exec() and the error is: ‘Undefined variable: PATH’.

So this must be the problem I suppose. Code Igniter must have its own system of do-ing what the putenv does. That is to add a path to the environmental path. Can someone help?
I must say that when I tried to run the script locally (without CI) it produced exactly the same errors as in the remote host with CI. It did not accept the putenv. But this may be because my files are not binary locally while they are binary on the host as I uploaded them with FileZilla in binary mode according to the instructions at the site of the script author.

I have also run the following:

echo exec ("swetest -edir$sweph -b$utdatenow -ut$utnow -p0123456789DAttt -eswe -house$my_longitude,$my_latitude,$h_sys -flsj -g, -head", $out, $error);
echo $error.'<br/>';
echo exec('whoami', $out, $error);
echo $error.'<br/>';

The first $error outputs ‘127’ which means ‘file not found or something’.
The second outputs my name and ‘0’ which means ‘all well’. So the Code Igniter exe-cutes the ‘whoami’ command probably because it can locate it while it has no clue where the ‘swetest’ command is.
So how can I add a path to the environmental path with CI? Or is it something else?

EDIT: I tried:
$PATH = 0;
before the:
putenv(“PATH=$PATH:$swephsrc”)
and it worked! The binary was executed and it filled the variables with data. Alas! My happiness did not last long… I begun receiving “Internal Server Errors” :-(. I don’t know if it is a coincidence or if it has to do with my actions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T10:33:50+00:00Added an answer on May 30, 2026 at 10:33 am

    The solution is:

    exec ("/absolute/path/to/executable/swetest -edir$sweph -b$utdatenow -ut$utnow -p0123456789DAttt -eswe -house$my_longitude,$my_latitude,$h_sys -flsj -g, -head", $out);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

have downloaded Orca to edit an MSI file. I want to remove some banner
I have downloaded some Open Source frameworks with the intention of learning and ultimately
I have downloaded and added this very simple, one file, php web file explorer
I downloaded a free reviews script from http://www.freereviewscript.com One of the files is encoded
I have downloaded phpshadow which is a php encoder I followed whole of explanation
We have an application, that can itself be downloaded for free, but works with
I have downloaded LEDA free edition from this website http://www.algorithmic-solutions.com/leda/ledak/index.htm First quetion: I want
I have downloaded a font that looks less than desirable if it is not
I have downloaded the silver light from this http://www.microsoft.com/silverlight// I need to use this
I have downloaded Privoxy few weeks ago and for the fun I was curious

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.