random1 Posted January 13, 2015 Share Posted January 13, 2015 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 Quote Link to comment https://forums.phpfreaks.com/topic/293888-using-variables-in-phpini/ Share on other sites More sharing options...
Ch0cu3r Posted January 13, 2015 Share Posted January 13, 2015 According to the PHP documentation here you can use Windows Environment Variables within the php.ini Quote Link to comment https://forums.phpfreaks.com/topic/293888-using-variables-in-phpini/#findComment-1502799 Share on other sites More sharing options...
Solution random1 Posted January 14, 2015 Author Solution Share Posted January 14, 2015 (edited) 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. thanks! Edited January 14, 2015 by random1 Quote Link to comment https://forums.phpfreaks.com/topic/293888-using-variables-in-phpini/#findComment-1502886 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.