Got a LAMP setup (as per Remy Sharp's set up) on OSX Snow Leopard, PHP 5.3
A site I am trying to run locally is built in CodeIgniter and utilises PEAR which until now I have not used locally.
I downloaded it but it seems that my local environment doe snot know where to look for PEAR.
which pear: /usr/bin/pear
which php: /usr/bin/php
my php.ini file has:
include_path=".:/usr/bin/pear
But for some reason I am just getting an error:
Message: require_once(Date.php):
even though Date.php has been installed in Pear
Any thoughts?
Ha! I've played this game across the years on Tiger, Panther, Leopard...
It's a lesson in frustration if you choose to go down this path--whatever you fix could be trashed the next time Apple wants to rename the /etc/httpd direcotry /etc/apache2. Then I just gave up. My advice is to not use the built in Mac Lamp stack, but to turn off Web sharing in the System Preferences and download and install MAMP or Zend server.
MAMP is configured with everything inside the MAMP.app package, mysql, php (with most pear/pecl libs you need), and apache. It also comes with a util to start/stop your servers.
Now....
If you must go down the route of not using something like MAMP/Zend Server, I'm assuming somewhere your include path is being overwritten.
Somewhere before the error, but after the framework is loaded, try this:
echo get_include_path();
See if you're path still is what you set in the INI file. If not, mischief is going on. Usual places to check:
.htaccess file in docroot of site
config files for your framework--they love to overwrite logging and path ini settings!
Somewhere in your code someone is calling set_include_path('/some/path') or ini_set('include_path', '/some/path')
Related
I am working on a PHP web app with another developer. We have 3 total different environments:
Configuration 1: Windows XAMPP, PHP 5.3.5
Configuration 2: Turnkey LAMP, PHP 5.3.X (turnkey-lamp-11.2-lucid-x86) - not sure which ver, running from virtualbox on a mac
Configuration 3: production server, hostgator shared running CentOS, php 5.3.9 fastcgi
Configuration 2 sometimes will not recognize the defines that are handled in our settings.php file which is require_once at the top of any page which uses it. The defines work fine on Configuration 1 and 3 always. There was nothing of interest in the apache logs, other than the errors generated as a result of the define being treated as a string.
I've searched for a while and cannot find anything that describes this issue. Configuration 2 is the other developer, and i do not have access to his machine right now. Looking for suggestions on how to track this issue down. I think we are going to try a new instance of the VM, using an upgraded turnkey-lamp, however i'd really like to root cause this.
Ok, so i figured out what was happening... and as expected, it wasn't PHP or defines. The errors reported were accurrate. We use Eclipse as the IDE, and Subclipse for SVN. Configuration 2 uses a VM running from a mac, and we added a command in eclipse to sync when files are saved. Apparently the syncing only was happening for the main public_html directory, and not our other same-level directory which has the include file with the defines in it. Ultimately, i needed to look at the actual VM to notice it was way out of date on that one file, and was missing the define statement, which results in the error, but Eclipse was showing the HEAD revision from SVN, which is why it was so confusing, but simple.
Lesson: Make sure you plugged in the TV before calling the repairman.
I am very new to Web development and wanted to run one of the Github project (https://github.com/remy/html5demos) on my Mac.
I have downloaded the project on my Mac and puzzled how to run it. Need help from all talented people across Stackoverflow.
The demo using php. Unfortunately, the apache installed on OSX (assuming you're on Snow Leopard) has not have php enabled by default and you need some admin-editing to enable it.
So, first move the unpacked folder remy_something into /Library/WebServer/Documents and rename it to easy name, for example "remy". (The final path /Library/WebServer/Documents/remy)
enable Web sharing in System preferences
point your browser to http://localhost/remy/index.php
if you get an rendered page - you're done, and can start playing...
if you get an error - something is terrible ;(
if you get a page where is the 1st line <?php - you're on good way - you need enable php.
For enabling php in OSX's apache, you should read for example: http://www.perfectline.ee/blog/how-to-setup-apache-and-php-on-mac-os-x-snow-leopard or any other guide you can find.
after enabling php and restarting apache (disable/enable Web sharing), you can check again the page...
I know this has been asked a few times here. But none of the suggestions or answers related to PHP on IIS have helped.
I have tried installing PHP ON IIS 5.1 (XP SP 3) on two computers and it still doesn't work.
I've even began to think that all of the articles and installers for PHP on IIS are a huge prank...and that PHP on IIS doesn't actually work.
I've spent the last 6 hours trying to get it to work. Nothing does. As of right now when I navigate to http://localhost/phpinfo.php all that shows up is: "The specified module could not be found." My IIS applications still work perfectly.
phpinfo.php contains:
<?php echo phpinfo(); ?>
Even loading test.php with "Hello World." in it gives me the same error message.
The current installation of PHP was installed from http://php.iis.net/ (the big blue button in the middle of the page). This installed PHP in my programs directory (F:\PHP).
That didn't configure PHP to work so I manually added the Application Mapping in "Web Sites" > Properties > Home Directory > Configuration > Mappings > Add.
I added C:\WINDOWS\system32\inetsrv\fcgiext.dll, ext .php, "GET,HEAD,POST"
Anyone have any idea what my problem is?
Sounds like you've not installed the FastCGI components (which to be honest you don't really need on your local development machine). Can I suggest mapping the .php extension to:
F:\php\php-cgi.exe (or wherever the PHP binaries are installed)
Also make sure you give your site's anonymous user account at least read access to the F:\PHP folder and children.
I think the DLL you are using for getting PHP to work have a missing dependency. Why don't you get a WAMP.
Do you really need to use IIS, using Apache would be far more easy IMHO. If you really want to use IIS, I advise to install the official PHP release they have a good README which describe all the steps to configure IIS or even an installer.
In the past, I used WAMPserver on windows to parse PHP for me. This is a pre-configured package, focussed on working with MySQL.
When I tried to run PostgreSQL, I got error messages that said that my version of PHP wasn't compiled to work with PostgreSQL.
So, I've recently uninstalled WAMP and every associated with it. I've downloaded Apache 2.2.11 with openSSL, installed as admin(you know, run the command prompt as administrator, cd to the directory where the download was done and have it executed, so the install was done as admin).
That's that. I now have Apache installed, "it works" shows up, so I'm that far.
Now I'm wondering, do I download the exe and install, or the zip, or something else.
What is the best thing to do to make sure that the PHP on my system can handle everything I can ever throw at it?
Also, PHP first, or MySQL/Postgre first.
And lastly, what about PEAR? I need PEAR installed, which isn't standard on Windows. I'm guessing the pear.bat file in the PHP downloads will do that for me?
EDIT: I see one close vote, yet no comment as to why. It makes me wonder how people who are so lazy and rude got to have somany points.
I would recommend downloading the zip package, as configuring php is not really that difficult, and it allows you to add features as needed.
As for whether first to install php or MySQL/PostgreSQL, - it does not really matter. You can install them in any order.
Your guess regarding PEAR is quite correct
i haven't used wamp before, so i can't comment on that
i do however use xampp which sounds very similar
in xampp if i want to enable postgres support i edit the php.ini file and uncomment the postgres section of the ini file, same with any of the extensions that i need
perhaps this might be an alternative you can try if you get stuck
There are many ways to setup a HTTP server/PHP/database machine. Sometimes the behaviour of your development setup will differ from the live server's.
I would recommend finding out the setup your web host is using, then getting a vmware appliance image that fits that as close as possible and get any additional software using it's package manager (which is easier that installing stuff on Windows).
Setup a file sharing link between the VM and the host, make sure you can view the VM's port 80 in a browser running in your host OS and you're set.
I am trying to install PHP onto my development box (XP SP3 / IIS 5.1) I've got PHP 5.2.6 stable downloaded (the MSI installer package) and I am getting an error "Cannot find httpd.conf". After that the install seems to breeze by quickly (more quickly than I would have expected) and when I try to execute a simple PHP script from my localhost test directory that I created, I get a slew of missing DLL errors. I have seen posts out there which indicate that its possible and has been done. I dont see any bug reports for this MSI at PHP.NET support. Any ideas?
Not sure if you already have this but I use WAMP from http://www.wampserver.com/en
It's easy and simple to set up, it has an icon in the system tray to show that its active and you can make it go online or available to the outside by clicking the icon and setting it. I used this when I was first learning PHP since it has everything in one, no need to setup any other service like IIS.
Probably the installer didn't configure your server to use PHP properly. Check out Microsoft's page on enabling PHP on IIS or alternatively switch to Apache if that's a viable option.
I'll see if I can remember it correctly:
Unzip PHP zip file into c:\Program Files\php (or run the installer)
Copy php5ts.dll into c:\windows\system32
Copy php.ini.dist into c:\windows and rename it to php.ini
Edit c:\windows\php.ini and look for extension dir - make it point to c:\Program Files\php\extensions (or wherever you put it)
This is where my memory gets fuzzy: Edit your IIS application settings, add a script map for .php files, and set the executable to php5ts.dll
Profit!?!??!?!