Need help using sessions on php 5 apache 2.4 on windows - php

I have apache 2.4 and php 5 on a windows 7 machine, everything is working great. However, I can't make a session script work: it gives me a warning that file does not exist. I tried to set session.save_Path="C:/tmp" in php.ini as default, and still get the same warning. Looked online but didn't find anything. Only thing I didn't try was a path to the htdocs folder. However being a session file I guess that's not a good idea?
Thanks in advance

Related

Can't run PHP after a new installation of XAMPP

I have been a happy user of XAMPP for years,
but today I have updated to the latest Windows 32 bit version on a Windows 10 machine.
I couldn't see a 64 bit version.
Anyway, all went well,
and once I changed some settings, I was able to see all my old databases under the new phpMyAdmin.
But my PHP scripts are bombing out before they start.
Even phpinfo gives the same error message, which is...
"Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'F:/My Documents/OneDrive/Webs/htdocs/index.php'
(include_path='.;C:/xampp/php/pear/PEAR') in Unknown on line 0"
The test script of index.php is nothing more than
<?php echo "HELLO"; ?>
The statement in php.ini is
include_path = ".;C:/xampp/php/pear/PEAR"
and there are no other include_path statements.
The directory C:/xampp/php/pear/PEAR does exist.
The index.php file is there.
I don't know why there's a PEAR folder inside a pear folder - that's how Xampp installed it.
I have tried all variations of that include_path statement to no avail.
I have left out one of the pears.
Leaving out the include_path statement altogether just results in the PHP default which is a folder which is definitely not there, so that's no good.
My localhost is inside the OneDrive folder as you can see from the error message, but I have been doing it that way for years.
Now I cannot run any PHP scripts. Pure HTML is no problem.
The new installation of Xampp has totally replaced the old one, and its Control Panel v3.2.2 looks to be working perfectly.
phpMyAdmin seems to be working fine, but not phpinfo, as said.
I have scanned the web for answers to this, and there is plenty of forum Q&A's, but they all tell me to do what I have done.
The computer is Windows 10 Pro, and is fully up to date. Apache 2.4.33.
PHP 5.6.35. Database server is 10.1.31 MariaDB.
I've run out of ideas. Any help will be appreciated.
Thanks Mike.
You need to fix your include_path system variable to point to the correct location.
To fix it edit the php.ini file. In that file you will find a line that says, "include_path = ...". (You can find out what the location of php.ini by running phpinfo() on a page.) Fix the part of the line that says, "\xampplite\php\pear\PEAR" to read "C:\xampplite\php\pear". Make sure to leave the semi-colons before and/or after the line in place.
Restart PHP and you should be good to go. To restart PHP in IIS you can restart the application pool assigned to your site or, better yet, restart IIS all together.
first: check all the paths in the php. ini ( use a search or a grep to check them)
second: check that you don't have any extensions added twice (one in the beginning and one in the end of the file)

mysqli_connect() using mamp

I have MAMP up and running and can run php in my browser, but when i attempt to connect to a MySQL database the connection fails. How do I correct this? I have read that to fix this I need to "enable php_mysqli extension in PHP.ini. It’s disabled by default. look for the following line: extension=php_mysqli".
I attempted this but i have multiple PHP.ini files and the first one i clicked on did not even have the line "extension=php_mysli".
I would like to know how to fix this problem so that i can test websites on my computer and not have to upload to a web server, also once everything is set up properly what are the correct parameters for the mysqli_connect() function?
Just installed MAMP to help you, and there is no php.ini in MAMP folder.
There is just 1 file php.ini in folder:
C:\MAMP\conf\php5.6.3\
since php5.6.3 is default version for my MAMP installation.
for my MAMP installation default user for MySQL is root and password root
I had this problem, my mysqli() function seemed to not be working after using it on multiple online servers. But not on MAMP! I followed all above instructions, looking in the php.ini files.
My fix...
I had my MAMP PHP version set to 7.0.0 (standard from install)
I changed this back down to 5.6.13 to test and everything started working correctly!
Im really not sure what caused it, or how to fix it to work with higher php versions.
Maybe something fundemental has changed since version 5.6.13.
Hope this helps someone! and please respond if you know why my problem is happening!

wamp server \ apache on Windows 7 does not load css and js files in subfolders

I've tried several versions of WAMP: 2.0 2.2 2.4 2.5 32 and 64,
and I've tried Apache stand alone on WINDOWS 7.
Root pages load but css, js and any other included files in sub-folders within a site do not load and Apace logs an access denied error.
It happens if the site is in the wamp/www folder or is an Apace alias.
I've tried gone through each step of the documentation, tried every config setting, install option, folder permissions, every idea found here and in every blog post Google returns in the search and nothing has worked. Allow all, vhosts, all those suggestions have failed.
What is up with WAMP/Apache on Windows 7? It worked fine right out of the box on my old XP machine.
thanks everyone hope someone has found a fix...
best, omcode
If you take a look into the source of the page (in your Browser), you'll quickly see that all your linked assets are using bad, non-resolving, or the wrong: path, domain, host, IP.
Possible walk trough's
check if rewrite_module is loaded if not check it and restart wamp.
Avoid relative path use absolute.
Check if the path & file-name is correct.
One of these will definitely be helpful for you.

curl_init() isn't functioning

Anyone faced the same thing before? I've tried the same script on a XAMPP, it worked. And I'm trying to do on a WAMP, it reported call to undefined function curl_init(). I've enabled and double-checked on my WAMP php.ini on line:
extension=php_curl.dll
The commenting was removed alright.
Could the reason be CakePHP ? I'm developing the App on Cake. Or something I need to do with WAMP...
You have to edit both these files:
wamp\bin\php\your php version\php.ini
wamp\bin\Apache\your php version\bin\php.ini
To get this problem where the side by side configuration is correct, but its still not working in wamp php 5.4.3 fixed. Follow: http://www.morningtime.com/kb/188
The php_curl.dll library is bugged and must be replaced. See attachment below. Replace the old php_curl.dll file (in your wampserver/bin/php/{version}/ext/ folder) with the new one attached. Restart Apache and you are set.
link that is currently working: http://www.morningtime.com/sites/default/files/attachments/book/188/php_curl-5.4.3-VC9-x64.zip
worked for me.
Thanks for pinpointing to checking out phpinfo() sometimes you just get too tired to test the basic. Well, after that I googled and found the solution. It seems that for a WAMP server, we need to enable both php.ini on folder PHP/..bin and Apache/..bin
I restarted after confirming both were enabled and here in phpinfo() I got curl enabled. I guess it should be working now.
or did you restart your wamp apache or what ever server you have?
EDIT:
maybe this helps. also notice the updates on top of the 1st post
How to get CURL to work with PHP on Windows? (WAMP)

a problem with creating a site in IIS 7.5 which is using PHP

I am trying to run web application scripted in PHP on windows server 2008. I have configured PHP (as fastcgi) and IIS. Everything goes fine except the following scenario.
In the php.ini document "doc_root" edited with the correct root path for my php projects which is "c:\inetpub\wwwroot\". I created a new site on IIS and mapped it's path to "c:\inetpub\wwwroot\application1". When I try to open this site, I see that somehow (IIS or PHP no idea ) does nt run my new application on the path "c:\inetpub\wwwroot\application1". It tries to run on "c:\inetpub\wwwroot\", which returns 404 of course. What am I missing here ?
Check to see whether you are changing and loading Correct php.ini file using phpinfo()
For those who have the same problem;
I have figured out the problem. setting "doc_root" is not right. As I commented that property in php.ini file it got ok.
Also checking the following url was helpful:
http://learn.iis.net/page.aspx/246/using-fastcgi-to-host-php-applications-on-iis-7/
Its written there that you can make your php web sites use seperate php.ini files. I found this link really usefull.
Don t want to choose my answer as the right one but have to. Hope this helps.

Categories