Jump to content

Using Variables in PHP.ini?


Go to solution Solved by random1,

Recommended Posts

I'm running the latest stable version of PHP in Apache Server on Windows 7 64-bit.


 


It working fine and set up correctly.


 


I'd like to use ENVIRONMENT VARIABLES or a variable like "%current_directory%" or "..\%current_directory%" in the configuration files for PHP, php.ini.


 


Is this possible? Is php.ini a parsed file, can variables be define and used in it? Help would be much appreciated  :D


Link to comment
Share on other sites

  • Solution

Thanks for the reply.

 

I got it working by creating a .CMD file for creating the Windows Environment Variables (only Windows 7 or later):

SETX DEV_SERVER_DIR D:\webserver /M
SETX DEV_SERVER_APACHE_DIR D:\webserver\apache /M
SETX DEV_SERVER_PHP_DIR D:\webserver\apache /M
SETX DEV_SERVER_MYSQL_DIR "D:\webserver\mysql\MySQL Server 5.6" /M
SETX DEV_SERVER_MYSQL_DATA_DIR "D:\webserver\mysql\MySQL Server 5.6\data" /M
pause

and then in PHP.ini, for example:

[PHP]
include_path = ".;${DEV_SERVER_APACHE_DIR}\htdocs"

and start the Apache Windows Service and check the variable with phpinfo. :D thanks!

Edited by random1
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.