@@ -114,22 +114,35 @@ func Use(args []string) {
114
114
}
115
115
}
116
116
117
- // remove old bat script
117
+ // remove old php bat script
118
118
batPath := filepath .Join (binPath , "php.bat" )
119
119
if _ , err := os .Stat (batPath ); err == nil {
120
120
os .Remove (batPath )
121
121
}
122
122
123
- // remove the old sh script
123
+ // remove the old php sh script
124
124
shPath := filepath .Join (binPath , "php" )
125
125
if _ , err := os .Stat (shPath ); err == nil {
126
126
os .Remove (shPath )
127
127
}
128
128
129
+ // remove old php-cgi bat script
130
+ batPathCGI := filepath .Join (binPath , "php-cgi.bat" )
131
+ if _ , err := os .Stat (batPathCGI ); err == nil {
132
+ os .Remove (batPathCGI )
133
+ }
134
+
135
+ // remove old php-cgi sh script
136
+ shPathCGI := filepath .Join (binPath , "php-cgi" )
137
+ if _ , err := os .Stat (shPathCGI ); err == nil {
138
+ os .Remove (shPathCGI )
139
+ }
140
+
129
141
versionFolderPath := filepath .Join (homeDir , ".pvm" , "versions" , selectedVersion .folder .Name ())
130
142
versionPath := filepath .Join (versionFolderPath , "php.exe" )
143
+ versionPathCGI := filepath .Join (versionFolderPath , "php-cgi.exe" )
131
144
132
- // create bat script
145
+ // create bat script for php
133
146
batCommand := "@echo off \n "
134
147
batCommand = batCommand + "set filepath=\" " + versionPath + "\" \n "
135
148
batCommand = batCommand + "set arguments=%*\n "
@@ -141,7 +154,7 @@ func Use(args []string) {
141
154
log .Fatalln (err )
142
155
}
143
156
144
- // create sh script
157
+ // create sh script for php
145
158
shCommand := "#!/bin/bash\n "
146
159
shCommand = shCommand + "filepath=\" " + versionPath + "\" \n "
147
160
shCommand = shCommand + "\" $filepath\" \" $@\" "
@@ -152,6 +165,29 @@ func Use(args []string) {
152
165
log .Fatalln (err )
153
166
}
154
167
168
+ // create bat script for php-cgi
169
+ batCommandCGI := "@echo off \n "
170
+ batCommandCGI = batCommandCGI + "set filepath=\" " + versionPathCGI + "\" \n "
171
+ batCommandCGI = batCommandCGI + "set arguments=%*\n "
172
+ batCommandCGI = batCommandCGI + "%filepath% %arguments%\n "
173
+
174
+ err = os .WriteFile (batPathCGI , []byte (batCommandCGI ), 0755 )
175
+
176
+ if err != nil {
177
+ log .Fatalln (err )
178
+ }
179
+
180
+ // create sh script for php-cgi
181
+ shCommandCGI := "#!/bin/bash\n "
182
+ shCommandCGI = shCommandCGI + "filepath=\" " + versionPathCGI + "\" \n "
183
+ shCommandCGI = shCommandCGI + "\" $filepath\" \" $@\" "
184
+
185
+ err = os .WriteFile (shPathCGI , []byte (shCommandCGI ), 0755 )
186
+
187
+ if err != nil {
188
+ log .Fatalln (err )
189
+ }
190
+
155
191
// create directory link to ext directory
156
192
extensionDirPath := filepath .Join (versionFolderPath , "ext" )
157
193
extensionLinkPath := filepath .Join (binPath , "ext" )
0 commit comments