Can find the php.ini file - apache2

I've installed PHP 5.2.17 on Apache 2 on Windows Vista into the directory c:\Web\Webserver\PHP5\
However phpinfo in showing that the Configuration File Path is c:\Windows and the Loaded Configuration File is (none).
The httpd.conf has the following lines:
LoadModule php5_module "c:/Web/WebServer/PHP5/php5apache2_2.dll"
AddHandler application/x-httpd-php .php
PHPIniDir 'c:\Web\Webserver\PHP5\'
Windows control panel shows that the path environment variable includes my installation directory (at the front of the path) and that PHPRC variable also points to my installation directory.
So why is it looking in c:\Windows for the php.ini?
If I put a copy of php.ini in c:\Windows it still says that it cannot find it. What's going on?

try to search php.ini from search in windows

Are you sure the PHPRC is a system variable, and not a user variable?
Have you rebooted?
Have you installed Sysinternals Process Explorer, and right-clicked the Apache process to verify that the PHPRC parameter is in the enviroment (via the Properties tab).
Have you considered Linux? :)

The above answers are good, but didn't solve the problem that we had.
As the others mentioned (spot on), I created a file:
<?php
phpinfo();
?>
So that worked great. However, it showed "(none)"
So where do you find (none)!?
You can't find what doesn't exist, of course.
The answer actually is, you don't HAVE a php.ini; you'll need to create it.
In my case, on Windows, you just go to where php is installed; I had already had installed it in c:\php I believe it would be the same steps on other platforms.
Then, from a command line, powershell for ex, type: notepad c:\php\php.ini
Tell it yes, you do want to create it, then add whatever changes you needed in the first place. For me, for example:
extension_dir = "c:\php\ext"
extension=mysqli
upload_max_filesize = 25M
post_max_size = 13M
max_execution_time = 300
Then save. Fixed!
By the way - if you do "file new" and then "save as" Notepad will (not so) helpfully rename your file to php.ini.txt.

Related

Run .bat as a Windows Service

I'm here again with another case that is getting me out my mind.
So, this is happening, I'm trying to run an executable java class(.jar) as a Windows Service, and all my attempts failed so far. To make it a little easier, I turned my jar into a batch file, wich only executes the jar in background, here is the code:
start "" javaw -jar C:\LocalService.jar
The batch works fine. However I have tried to install this batch as a service by using the next line in cmd:
sc create "LocalService" binPath= "C:\LocalService.bat"
The Service installs correctly, but as soon as I try to start it, it pops up an error (The code error is 1053, says something about the service did not start correctly)
Also, I have try with a software called NSSM (non-sucking service manager) It installs fine too, but the service does not start either.
Do you guys know what am I missing?
By the way, I'm doing all this on Windows 7 Professional.
Thanks!
thanks for your comments
Both tools didnt work for me, sadly. However I was able to do it with a software called Java Service Wrapper. This is not a free software, so I needed to buy a license to get it to work.
The steps were simple:
1.-Create a folder with the name of the service, then inside add 4 folders: lib,bin,logs,conf
2.-On the lib folder you have to copy your jar and also the wrapper.jar and wrapper.dll (these last two are in the zip you download from the website)
3.-Copy 4 files to the bin folder: InstallApp-NT.bat.in, App.bat.in, UnintstallApp-NT.bat.in and wrapper.exe (this last one is the one that defines your license, if you can get a file wrapper.exe from somebody else who had paid a license it will work fine. These file also came in the zip from the website) Remove the .in from the batch files
4.-The most tricky step is this: You have to copy from the wrapper's folder called conf a file called wrapper.conf.in Remove the .in extension and edit it with a tex editor. The most important lines you have to edit are:
wrapper.java.command=C:\Program Files (x86)\Java\jre7\bin\java //Specify JRE Path. Will work with eviroment variable
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperJarApp //Choosing this class means your are using a .jar file to execute when the service starts
wrapper.java.classpath.1=C:\LocalService\lib\wrapper.jar //This one is constant.
wrapper.java.classpath.2=C:\LocalService\lib\LocalService.jar //This is the path to your executable jar
wrapper.java.library.path.1=C:\LocalService\lib //Path to your own lib folder (the you created at the begining)
wrapper.app.parameter.1=C:\LocalService\lib\LocalService.jar // again the path to your jar
Then just execute the InstallApp-NT.bat and start the service and your are done
It worked to me with absolute paths, however according to documentation it will work fine with relative path too.
This is how I solved my problem and I hope someone with the same issue will find this helpful
See you next time!

upload_max_filesize set to 4M in phpinfo(), can't change it!

I've got this in my php.ini
upload_max_filesize = 25M
post_max_size = 25M
and I've got this in my .htaccess
php_value upload_max_filesize 26214400
php_value post_max_size 26214400
as shorthand can only be used in the php.ini (http://www.php.net/manual/en/faq.using.php#faq.using.shorthandbytes)
but no matter what I do, when i call phpinfo() I get
Directive Local Value Master Value
upload_max_filesize 4M 25M
I've looked at all other php.ini files, my .htaccess, ini_set(). Anything I could think of and nothing will change it from 4M. Any help would be great!
EDIT: restarting apache didn't work, i've check my httpd.conf, it seems like an external file or something. any other places to check?
That doesn't look like proper syntax for a php.ini file.
upload_max_filesize = 25M
post_max_size = 25M
Then, make sure to restart Apache.
If you still have troubles, refer to:
http://www.cyberciti.biz/faq/linux-unix-apache-increase-php-upload-limit/
I had same issue, but restarting php-fpm helped.
So it didn't help to restart just apache2, but this command:
sudo systemctl restart php7.3-fpm
Cleared probably some cache and took the new modified php.ini.
If you're using OSX then make sure your php.ini file is not the default one in /etc (php.ini.default) with the command php --ini,
output sample :
Configuration File (php.ini) Path: /etc
Loaded Configuration File: /etc/php.ini
Scan for additional .ini files in: /Library/Server/Web/Config/php
Additional .ini files parsed: (none)
in case the first line: Configuration File (php.ini) Path with empty parameter make a copy of the default php ini and the changes will take affect.
also, you'll have to check the memory_limit directive.
If it's lower than upload_max_filesize or post_max_size then their value will be limited to the memory_limit value.
Anyway, post_max_size should be slightly larger than upload_max_filesize (any posted values other than the file itself would need some memory as well)
On modern systems, memory_limit should be at least 64M, 128M or more is recommended
If you are running PHP Fast cgi then you need to restart the process. I believe that restarting apache should do the trick.
Problem was it was actually being set in another .ini file that didn't appear at first glance to be related to anything!
Note to self: always use "grep" to search within files when things are fishy!
If you are running in a local server, such as wamp or xampp, make sure it's using the php.ini you think it is. These servers usually default to a php.ini that's not in your html docs folder.
If you are using WAMP then make changes in proper php.ini which apache uses, normally its found in C:\wamp\bin\apache\\bin.
make changes in 2 parameters post_max_size and upload_max_filesize (found in line 734 and 886, usually), to 50M (to upload files upto 50 MB).
don't forget to restart apache.
I could solve this problem via a workaround. I created .user.ini file in the root document of my webapp and overwrite the values.
I was facing the same issue.
Check Loaded Configuration File path in php info.
Then open that file and change the variables you want and restart your apache server.
Make sure that you're editing the php.ini in the conf/"server_version" folder
Make sure that your computer is not hiding a .txt on the end of the php.ini file.
Use terminal or right click / get info or properties.

vim cannot connect to cscope database

I have opensuse 11.4 installed. Vim is version 7. Now I normally use it to browse the linux kernel source. So I generated the cscope database inside a directory within my home folder i.e. /home/aijazbaig1/cscope_DB/ and I got 3 files viz. cscope.out, cscope.po.out and cscope.in.out besides the cscope.files file which contains a list of all the relevant files which I want to search.
Additionally I have added the following to my .bashrc:
CSCOPE_DB=/home/aijazbaig1/cscope_DB/cscope.out
export CSCOPE_DB
But when I do a :cscope show from within vim it says there are no connections. Can anyone please let me know what is going wrong.
Keen to hear from you,
This is mentioned in the comments above, but I want to make sure it's preserved in an answer.
The issue that came up for me was that vim didn't know where to look for the cscope database. When I added
cs add $CSCOPE_DB
to my .vimrc. Everything came out fine.
I figure since I've made the visit, I would try responding.
I was getting this error when searching using ctrl-space s (or any search for that matter):
E567: no cscope connections
I finally found the full solution at http://cscope.sourceforge.net/cscope_vim_tutorial.html, Step 11.
The idea is that you create a list of source files to be included in the view of cscope, generate the cscope.out in the same location, and update the export path accordingly:
find /my/project/dir -name '*.c' -o -name '*.h' > /foo/cscope.files
cscope -R -b (this may take a while depending on the size of your source)
export CSCOPE_DB=/foo/cscope.out (put this in your .bashrc/.zshrc/other-starting-script if you don't want to repeat this every time you log into the terminal)
You need to add a "cscope connection", like this in vim:
:cscope add $PATH_TO_CSCOPE.out
See :help cs for more examples.
Here's how I explore linux kernel source using cscope:
I use vim as my editor.
While standing inside the kernel source root directory, run cscope in interactive mode while recursively going through subdirectories during search for source files:
cscope -R
When run for the first time, it will generate the database file with the name: cscope.out inside the current directory. Any subsequent runs will use the already generated database.
Search for anything or any file and open it.
Set cscope tags in vim to make the :tag and CTRL-] commands search through cscope first and then ctags' tags:
:set cscopetag
Set cscope database inside current VIM session:
:cs add cscope.out
Now you can use CTRL-] and CTRL-t as you would do in ctags to navigate around! :)
I have the same issue on my PC. For now, to solve the issue:
On terminal execute: which is cscope
Open .vimrc file to edit: set csprg=/usr/bin/cscope
I ran into a similar problem with no cscope connections on ubuntu 18.04, then I discovered my .vimrc file does not load the CSCOPE_DB variable. Looked a little around and found a solution.
You can just copy this directly in to your .vimrc file.
Part of the code loads your cscope file from your directory. The keybinds are just a nice bonus.
Hope this helps.

Firefox custom extension installer

i am searching for hours now, a way that could allow me to install (optionally) a custom firefox extension along with my software installation package.. i can't find anything useful tho. Tried the registry method, the -install-global-extension method, the "Copy to extensions path" method... but nothing seems to work.
Any ideas on how to let the user chose if he wants to install my extension after my package install is finished?
You have this tagged "batch" so I'm assuming you are looking for a way to install extensions from the command line using batch format.
What is the output if you were to use something like this?
for %%e in ("path to extensions\*.xpi") do "firefox.exe" -install-global-extension "%%e"
I have an Nsis installer that in one of its steps copies a Firefox extension to the extensions directory. That works for every Firefox version from 3.0 to 4.0.
First it finds out which is the directory for the default profile, following this pattern: %APPDATA%\Mozilla\Firefox\Profiles*.default. Once profile name is determined (for example "4v3vxq80"), it copies the extension to %APPDATA%\Mozilla\Firefox\Profiles\$1\extensions (where $1 is the profile name).
I think the key is that all these steps are performed when Firefox is not running (I check for a running firefox.exe at the beginning).
Let me know if you want the nsis code that does the trick.

Cannot run program "make": The system cannot find the file specified?

This is the first time that this error has come up. I am using Cygwin with Eclipse 3.5 and my Path variable is set to: %CommonProgramFiles%\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Apache Ant\bin;C:\Program Files\SVN\bin;C:\Program Files\Java\jdk1.6.0_18\bin;C:\Users\Mohit\Developer\AndroidSDK\tools;C:\Program Files\QuickTime\QTSystem\;C:\cygwin\bin Notice that C:\cygwin\bin is in my Path. And make.exe is is my Cygwin bin. So I think the problem is not with my system, but maybe my project. But I can't find anything wrong with it. Any suggestions?
Use Process Explorer to take a look at the PATH environment variable inside Eclipse's process. It's possible that it's changing its PATH internally -- if that's the case, you'll need to figure out how to configure Eclipse so that its PATH is set up correctly.
If you're finding that C:\cygwin\bin isn't in Eclipse's PATH, and you recently added that to your PATH, you need to close and restart Eclipse for that change to take affect.
If you still can't figure it out, try using Process Monitor with a filter for Eclipse.exe to get a long, detailed listing of everything it's trying to do. Look for the call to CreateProcess() that's failing and see if you can learn anything more.
I had same problem and I solved that copy make.exe file in path that ecilipse given.
from link below
http://www.mediafire.com/download/e9j9g4zun2t68jn/make.exe
hope helps
I go around this issue by installing MinGW and use its GCC compiler.
Environment - OS: Windows 10, Eclipse: Oxygen

Resources