PDA

View Full Version : Command line php



Ryanmt
January 23rd, 2007, 10:14 PM
Im trying to write a php program that runs as server, Ive installed xammp but i still get php: command not found.

What do i need to do to run/install command line php applications?

Thanks
Ryan

tocleora
January 23rd, 2007, 11:22 PM
If you're running php 5 run this:


sudo apt-get install php5-cli

php 4:


sudo apt-get install php4-cli

That should take care of it. :guitar:

Dygear
January 24th, 2007, 10:29 AM
On the windows side of things, you just have to add php.exe to the path system variable.

Dygear
January 24th, 2007, 10:32 AM
Request this post be deleted!

Ryanmt
January 25th, 2007, 09:38 PM
That did the trick Thanks. However im having problems with sql.

Im making a server interface to phpBB.

I everything setup and working ok with xammp for the http:// side of the forum, the mysql database is up and running.

I now need to access the same database from the command line. Ive tried including the default connect file from phpbb and it says ..

Fatal error: Call to undefined function mysql_connect() in /opt/lampp/htdocs/phpBB2/db/mysql4.php on line 48


i read that it could be a php.ini setting however im not sure what i need to do!

maddog39
January 25th, 2007, 09:49 PM
The problem is that XAMPP is it's own self contained package and it doesnt install anything on the system (in the system directories) per se.

Therefore, you also have to install mysql.


sudo apt-get install mysql5-client && sudo apt-get install mysql5-server

Then I think you need to enable it by uncommenting the module in the php.ini file which is located here:

/etc/php5/cli/php.ini

Ryanmt
January 25th, 2007, 09:52 PM
will i still be accessing hte same database i have running that way or will that be a totally seperate version of mysql running?

if its seperate will i need to install phpmyadmin into it, how will i go about setting up local host then :s Thanks

Ryanmt
January 25th, 2007, 09:54 PM
ryanmt@penguin:/etc/php5/cli$ sudo apt-get install mysql5-client && sudo apt-get install mysql5-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package mysql5-client


:(

Ryanmt
January 25th, 2007, 10:20 PM
i just tried to install it from the synaptic and it failed on setting the server up (bring it back online to be exact).

Im lost here, can anybody point me in the direction of a good guide. How do i go about getting of hte stuff ive already setup to avoid confusion.

tocleora
January 25th, 2007, 10:53 PM
I've tried xampp before and had bad luck with it due to it's configuration, so my suggestion is to uninstall it and install everything directly. In Synaptic you can install apache(2), php(5) and mysql(5). You'll want to make sure you include the mysql module for php (php5-mysql). I think phpmyadmin is in synaptic too but I think webmin (if you use it) has to be installed from the .deb on their web site. Then you should be able to use both from the same database. Respond back here if you have problems.

Ryanmt
January 26th, 2007, 01:41 AM
I got that working all ok now so it seems. I wish i had backed up my old msql database though *muppet*

Thanks :)

maddog39
January 26th, 2007, 03:29 AM
Okay, well a while back I made a shell script to install a complete server installation from the ubuntu repositories for a friend, and it works for sure (in edgy). So I have attached it. Just run:

cd Desktop;chmod +x lamp.sh;./lamp.shShould work to run the script. It will install PHP5, MySQL 5, PHP5-GD, PHP5-CLI, and phpMyAdmin

tocleora
January 26th, 2007, 04:15 AM
That script I'm sure will be very handy for others on this site as well. Very cool!

jelkimantis
January 26th, 2007, 05:51 AM
Okay, well a while back I made a shell script to install a complete server installation from the ubuntu repositories for a friend, and it works for sure (in edgy). So I have attached it. Just run:

cd Desktop;chmod +x lamp.sh;./lamp.shShould work to run the script. It will install PHP5, MySQL 5, PHP5-GD, PHP5-CLI, and phpMyAdmin

you could always dl a LAMP Virtual machine from www.rpath.com, then you can develop with it and then trash it if you mess up.

jsl