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 3964492
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:20:28+00:00 2026-05-20T03:20:28+00:00

I want to change the default system $PATH var for the period of php

  • 0

I want to change the default system $PATH var for the period of php script execution, but it for some reason fails.

Im trying the following:

<?php
$lastline = system('export PATH=$PATH:/customBin;',$return) OR die("why do i die all the time");
echo $lastline;
?>

But it obviously dies all the time. (tried on both RHEL & Debian linux distros, php version 5.3.xx, other system commands work fine (cat, ls, etc) neither of these work: export PATH=$PATH:/customBin; OR export PATH=$PATH:/customBin: OR export PATH=/customBin, all of these work in the shell tho..)

Any help is appreciated. thanks.

EDIT: Above code is wrong, solution is to use putenv('PATH=$PATH:/customBin');

  • 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-20T03:20:28+00:00Added an answer on May 20, 2026 at 3:20 am

    You might have better luck using putenv to change environment variables from PHP. Just fetch the current value with getenv, add whatever you like and finally call putenv to alter the value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing some kind of own templates system. I want to change <title>{site('title')}</title> Into
When Dropdown is opened - I want to change default color of it. I
I want to change the default arguments passed to a Ruby function. For example,
I want to change the default homepage (which appears on typing http://myserverip:8080) and redirect
I want to modify / change the way the floatformat works. By default it
Is there a way I can change the default system mouse pointer from within
I want change the default code generator of ASP.NET MVC and use Hanselman Way
How do I change default cord system and units in OpenGL? Right now it's
Not sure what I'm doing wrong here. But I want to change the card
I am trying to figure out how to change the default layout to 2

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.