Jump to content

Search the Community

Showing results for tags 'linux'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

  1. Hello, There is one php file, the logic is when this code is executing it is getting some data and place in DB, The problem is that when this file I executing from browser, it is working, but when I execute this file from linux shell (as apache user, or root user) like "/usr/bin/php script.php", It is not working, but without any errors. Please advise what I am missing. P.S. Centos8, apache, php 7.4.9
  2. hello dear all , topic: questions with some eplanations - for db-related areas and topics - export er-diagram i want to post questions with some eplanations - for db-related areas and topics. Well i know that there are some good tools out there which help here alot. The question is : how to export the data so that i can implement the data into a forum like this !?! Question can i export the data form https://www.draw.io/ to this forum!? Love to hear from you regards
  3. ajoo

    linux command sed

    Hi all ! Can someone please explain what the following command does:- sudo sed -i s,scotchbox.local,$DOMAIN,g /etc/apache2/sites-available/$DOMAIN.conf sudo sed -i s,/var/www/public,/var/www/$DOMAIN/public,g /etc/apache2/sites-available/$DOMAIN.conf I can across these commands in here. I have tried them out in the terminal as a modified example :- sudo sed -i, s,www,the,g test.txt. where test.txt has 2 lines of some text containing the word 'the' a couple of times. The command seems to do nothing. There is no change in test.txt. I cannot get any example of sed -i, s on google. In fact i cannot get a similar example of sed anywhere on google. But then i believe sed is extremely versatile and has tons of usages. Grateful for any help. Thanks all.
  4. good day dear php-freaks i need to rename files in _ one _ directory - more than 50 files are in this..folder: the files are named like so: 01 02 03 04 ... 49 50 each file has got a number as a file name. each file should get a character - like so: r01, r02, r03, r04 and so on . .... r50 how can we do this on commandline
  5. hello dear community I’m trying to capture the output of the top command into a file. When I execute top > output.txt, the output.txt file contains lot of junk characters. What is the best method to capture the output of the top command into a readable text file? i tried to use the top command batch mode operation option ( -b ) to capture the top command output into a file. top -n 1 -b > top-output.txt or this one less top-output.txt but - unfotunatly they do not work for me... : linux-a9sq:/home/martin # -n 1 > top-output.txt -n: command not found linux-a9sq:/home/martin # top-output.txt If 'top-output.txt' is not a typo you can use command-not-found to lookup the package that contains it, like this: cnf top-output.txt linux-a9sq:/home/martin # top -n 1 -b > top-output.txt linux-a9sq:/home/martin # top -n1 -b | head5 If 'head5' is not a typo you can use command-not-found to lookup the package that contains it, like this: cnf head5 linux-a9sq:/home/martin # what can i do!? love to hear from you greetings
  6. In the following pages I'm trying to validate if a user is signed in or not. If the user is signed in I would like to see 'Log Out' printed to the screen(I'll do more with that later). If the user is not signed in I would like to see a login form at the top right of the screen. As it stands I'm only seeing 'Log Out' on the screen, I can't get the form to show up anymore. I thought it might be because the session variable was still hanging around but I restarted my computer to make absolutely sure but I'm still just getting 'Log Out'. At the moment I need this program to work as is as much as possible. If you see an entirely different approach that you would use that's fine but I don't currently have the time to go changing a lot, I need to get this going kinda quick. Thanks. records-board.php <?php require_once('includes/init.php'); if(!isset($_SESSION)) { init_session(); } ?> <html> <head> <Title>Pop Report</title> <link rel="stylesheet" type="text/css" href="styles/popreport2.css"> <h1>Pop Report</h1> </head> <body> <?php if(isset($_POST['nameinput']) && isset($_POST['passinput'])) { $nameinput = $_POST['nameinput']; $passinput = $_POST['passinput']; User::sign_in($nameinput, $passinput); } if(!isset($_SESSION['user'])) { print_form(); } else { echo "Log Out "; echo $_SESSION['user']->name; // this line was just trouble shooting, it told me nothing! } ?> user.php <?php if(!isset($_SESSION)) { init_session(); } class User { public $name; public function __construct($username, $password) { $connection = get_db_connection(); $query = $connection->query("SELECT * FROM users WHERE username='$username' AND password='$password'"); if(!$query) { echo "Invalid username or password"; } else { $result = $query->fetch(PDO::FETCH_ASSOC); if(!$result['username'] == $username || !$result['password'] == $password) { echo "Invalid username or password"; } else { $this->name = $result['username']; } } } public static function sign_in($username, $password) { $_SESSION['user'] = new User($username, $password); } } ?> <?php function print_form() { echo "<form id='loginform' name='loginform' action='records-board.php' method='post'>"; echo "Username: <input type='text' name='nameinput'>"; echo "Password: <input type='text' name='passinput'><br />"; echo "<input type='submit' value='Sign In'>"; echo "</form>"; } ?>
  7. I'm getting the following errors when I run `cat /var/log/apache/error.log` -> PHP Notice: Undefined variable: db_connection in /var/www/html/popreport/includes/inmate.php on line 18 -> PHP Fatal error: Call to a member function query() on a non-object in /var/www/html/popreport/includes/inmate.php on line 18 When I try this in my browser I start with test.php test.php <?php require_once("./database.php"); require_once("./inmate.php"); // foreach($query as $row) // { // print_r($row) . "<br />"; // } $inmate = array(); $inmate = new Inmate($inmate); foreach($inmate as $row) { print $row->firstl_name . "<br />"; } ?> database.php <?php include("./constants.php"); try { $db_connection = new PDO("mysql:host=$host;dbname=$db_name", $db_user, $password); $db_connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } catch (PDOException $e) { print "Error!: " . $e->getMessage() . "<br />"; die(); } ?> inmate.php <?php require_once("./database.php"); class Inmate { private $first_name = ''; private $last_name = ''; private $full_name = ''; private $race = ''; private $number = 0; private $facility = ''; private $type_of_transit = ''; public function __construct($inmate) { $sql = "SELECT * FROM inmate_board"; $query = $db_connection->query($sql); $result = $query->fetch(PDO::FETCH_ASSOC); foreach($result as $row) { $this->$first_name = $result['first_name']; } } public function get_property($property) { return $this->$property; } } ?> In inmate.php I also tried to change the line `$query = $db_connection->query($sql);` to `$query = global $db_connection->query($sql);` but I didn't have any luck here either. Any ideas?
  8. [Linux] PHP Notice: Undefined variable: connection in /var/www/html/popreport/functions.php on line 23 PHP Fatal error: Call to a member function query() on a non-object in /var/www/html/popreport/functions.php on line 23 The fuction output in the following program is called from another file called records records-board.php If you look at the program below you'll see that I did define $connection above line 23 in the file functions.php And for the second error I'm really not getting it because that same foreach loop was working fine with the exact same argument list when it was in the file records-board.php, but now that I've copied most of the code from records-board.php and placed it in functions.php all the sudden my program can't see the variable $connection and has a problem with my foreach loop on line 23. Again, both of those lines worked fine when they were in another file. functions.php <?php //session_start(); // open a DB connectiong $dbn = 'mysql:dbname=popcount;host='; $user = 'user'; $password = 'password'; try { $connection = new PDO($dbn, $user, $password); } catch (PDOException $e) { echo "Connection failed: " . $e->getMessage(); } $sql = "SELECT full_name, tdoc_number, race, facility FROM inmate_board WHERE type = 'COURT'"; function output() { foreach($connection->query($sql) as $row) { echo "<tr><td>$row[full_name]</td></tr>"; } } ?> records-board.php <? include 'functions.php'; php output(); ?> Any ideas?
  9. Hi all. I have a script that i want to run in a cronjob. but i dont know why it's not running. i am using godaddy cpanel ps: when i visit the url of the file, it works as expected, and also when i run it via a form button, it works also. what could be the problem? below is the command i used: /usr/local/bin/php -q /home/username/directory/directory/file-name.php thanks
  10. Hello All, Have a GoDaddy MySQL PHP:PDO hosting questions. Using a database class to make script queries. Unfortunately, I'm required to use GoDaddy Windows hosting. However, I'm a Linux kind of guy. Here's the issue. The viewer script includes database credentials defined as constants, in a file outside the root directory. Typically, these constants are available to all sub processes including class objects. Everything works as expected on development server. The error message I get with version using constants: L226: projectGallery_class datapull Caught Exception --- invalid data source name with host string userDBName.db.6482519.hostedresource.com;dbname=userDBName However when I deploy to GoDaddy's production server, the constants are defined - but empty. Here is the example code. /* works on Linux */ class datapull { var $host; // not assigned here var $userName; // not assigned here var $userPass; // not assigned here protected function conn() { try { $DB = new PDO(DB_HOST,DB_UNAME,DB_PASS); $DB->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); return $DB; } catch( Exception $e ) { $mes = "L226: datapull::conn() Caught Exception --- "; $mes .= $e->getMessage(); error_log($mes); } } public function dbquery($qqueue) { $DB = (!isset($DB)) ? $this->conn() : $DB; /* some query stuff here */ return $result } The modified class for GoDaddy Windows class datapull { var $host = “mysql:host=userDBName.db.1234567.hostedresource.com;dbname=userDBName”; var $userName = “userDBName”; //godaddy user and database naming convention var $userPass = “userPWDString”; //user password protected function conn() { try { $DB = new PDO($this->host,$this->userName,$this->userPass); $DB->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); return $DB; } catch( Exception $e ) { $mes = "L226: datapull::conn() Caught Exception --- "; $mes .= $e->getMessage(); error_log($mes); } } public function dbquery($qqueue) { $DB = (!isset($DB)) ? $this->conn() : $DB; /* some query stuff here */ return $result }
  11. hello dear php-experts, i want to run and show facebook-actiity feeds (in other words "streams of two different facebook sites) that said i cannot do this with one plugin - can i? well some guys taled bout a solution of copying and cloing a wordpress plugin I want to have multiple instances of the plugin running so i can have different related content on a single page. that said i heard that some guys just do one thing; they coly the copy the plugin. https://wordpress.org/support/topic/installing-2-copies-of-the-same-plugin?replies=8 but thie does not work - so i have to do one facebook-feed with a version like so question - how to include the code: https://developers.facebook.com/docs/plugins/activity Initialize the JavaScript SDK using this app: booksocial123 Include the JavaScript SDK on your page once, ideally right after the opening <body> tag. <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&appId=473241986032774&version=v2.0"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> Place the code for your plugin wherever you want the plugin to appear on your page. <div class="fb-activity" data-site="facebook.com/literaturen" data-action="likes, recommends" data-width="350px" data-height="350px" data-colorscheme="light" data-header="true"></div> how to include that into a wordpress
  12. hello dear php-experts, the question of the day - how to find a file with a certain text - the commands below do not help here .... the are good but they do not open the file find . | xargs grep "texthere" * grep -r "texthere" . grep -r "a target="_blank"" find ./ -type f | xargs grep "foo" hmm - well i guess that the grep command will help here. well i want to do a seach recursively - through all files in a folder. And i want to open fhe file - after it is found. How can we do this!? love to hear from you
  13. I've spent the last year building a web application on my local machines using the typical LAMP stack. I've been a developer for 10+ years and am fairly good when it comes to scripting but the server/hosting/system admin thing scares me. I've taken tons of sites live but they always exist on shared hosting and require minimal maintenence...simply ftp changes...no big deal. With my latest personal projects I've used revision control (git or mercurial) simply as a way to let me work from different machines. It's awesome. I push code from home, work, and my laptop and everything is in sync with one another. It really has changed the game for me. ( I use bitbucket) My latest project will involve paying customers and has a huge code base. FTPing files is not going to cut it. I've heard of having a "staging" environment so that you can push code to the staging environment, test it, and then push to production. That sound perfect! Every time I google git/staging I get pages and pages of command line stuff. I'm used to using version control GUI's like tower and sourcetree. Are there server environments that would allow me to use a GUI to manage version control? Or are linux server environments command line only? Are there any hosting companies you know of that would be a good fit for these needs? I'm looking to keep the hosting <= $20/month Thanks
  14. ant to install linux on a notebook (which i want to buy ) The notebook: hewlett packard - hp 14r103ng notebook with 4 (8GB) what do you think bout this idea. Question: i do not do play games. I only need the notebook to have a good one for being mobile. I plan to set the RAM to 8 GB immitiately after buying it. do you think that this is a good choice or do you suggest to go to a notebook that has a INTEL i 3 or INTEL i 5 processor again: i only need a notebook that does basic things... The notebook costs 260 to 290 Euro in Germany - thats a fair price - reasonable and okay i think. The notebook has got a dvd-drive... love to hear from you
  15. hello i want to crate a passepartout photo how to create a passepartout size in irfanview - do you have any experience? btw: if i have to change the background. - can i do this with irfanview too!? many thanks for any and all feedback
  16. hello dear PHP-experts i run opensuse 13.2 i ve set up an apache webserver - well - if i type localhost into the browser then i see: it works but i want to see also phpmyadmin: the phpmyadmin on apache server - installed but not visible - what can i do now. I think that i have to check the running services on the machine!!? Which test can be done - with the terminal ? Which tests can i run on commandline ? love to hear from you greetings
  17. hello dear PHP-experts, today i create a rescue-system for the emergency-situation: i am creating a little resque-usb for SUSE-DVD on USB-Stick currently plan to create a litle Rescue-USB while using Suse-ISO DVD on a USB medium 1:1 copied step 1. Suse-ISO download: here: http://ftp5.gwdg.de/pub/linux/suse/opensuse/distribution/13.2/iso/openSUSE-13.2-Rescue-CD-x86_64.iso step 2 copy the file onto a USB stick with the following command dd if=openSUSE-13.2-Rescue-CD-x86_64.iso of=/dev/sdX bs=32kwhere sdX=sdb or sdc is the USB stick ready - now i can test the rescue-usb
  18. hello dear php-community, today i have an special-question: the notebook samsung q 210 has got no brightness. in other words i cannot controll it. it is too dark see the data: Samsunng q 210, 12,1" OpenSuse 13.1: Intel® Core™ 2 Duo Proz. P8400 2,26 GHz 1066 MHz FSB 3 MB PC2-6400 (800 MHz), DDR2 SODIMM ; NVIDIA GeForce® 9200M GS any idea to change that?! love to hear from you greetings
  19. hello dear php-freaks at the moment i am installing and investigating. i have several notebooks here. i install linux and besides these tasks - i test several notebooks. i need to test harddrives. question: how to run smartmonttools on opensuse i found out that this package is one of the best ones http://www.smartmontools.org/ is the package allready installed on opensuse 13.2? i need to run it to check the healthy of the hdd btw: is smart - allready included in the gparted-Live-DvD
  20. hello dear php-experts on my notebook an Akoya P 6512 15" AMD Athlon X2 P320, 2,10 GHz, 4 GB that runs OpenSuse 13.1 i want to prepare the new installation of opensuse 13.1 but i cannot boot from a my DVD with the openSuse 13.2 b. my cd with the Gparted i tried out to enter the boot menu with f 2 - and subesquently editing the boot-device f 10 and switching the boot device nothing works - i have no glue what i can do now ? note : i run the following BIOS American Megatrends version 02.61 i need your help now - should i do a bios ubdate or what? many thanks for any and all help
  21. hello dear folks good evening dear PHP-Freaks, well i am not sure if this question fits here - in miscellaneous. but i am pretty sure that many many calc and excel-experts are here in this great forum. what is aimed: want to create a calendar - with 365-chunks that are imported into a caleandar form see some ideas where i can import this i posted the example-calc spreassheet that i want to import. note it has got 365 lines - for 365 days of the next year 2015 what needs to be done ; whats needs to be achieved: i need to impoort the example into the calendar form. see some of the examples -.. if i am able to import the texts (of the collumn ) in a writer or word document each line of the calc needs to get on a sheed of the word or writer. i need to know how to arrange this export of calc into the writer document. if i need to explain it more thoroughiy - just let me know! greetings you matze see some examples of calendar templates Blank daily calendar - Templates Daily lesson planner (color, landscape) - Templates note: all i need to know is to be able to export from calc to any word or calc document... see the attached sample below... 2015_sample_version_.ods.zip
  22. hello dear linux-community if a server needs to meed some requirements - eg for installation wordpress and if the server needs to run eg see here: https://wordpress.org/about/requirements/ then i need to have a closer look at the apache2handler in the php-ini Apache Version Apache all the mentioned are listed in the php-info.file note: here are no mod_rewrite Apache module so what
  23. hello - dear phpfreaks, i portet over a wordpress site to localhost. (an opensuse linux-box) all went nice and was very smooth to do so. after porting over the files and the db; i added the db-name and user-name etc. but nothing more. then i looked at the site http://localhost/mysite i saw the site - but only once - that is very very interesting. i read that i have to do more. Probably these changes - mentioned below are mandantory in order to avoid a blank page cf: https://managewp.com/how-to-create-a-local-copy-of-a-live-wordpress-site#comment-148613 question: is this true? Do i need to make these changes to avoid a blank page!?
  24. So I just started watching the videos from Stanford, Google, MIT and a few on youtube. One of them contained the code for using tkinter function to create an application window and I tried to put the same type of thing together can anyone tell me what I am doing wrong cause nothing is happeing for me. I am running linux mint: # - So this is what it feels like # - To be alive #!/user/bin/python import sys author = "Brian T. Flores" version = "0.1" sessionID = 0 #Get Interface from Tkinter import * #initialize interface root = Tk() #modify root window info root.title("Unknown Limits - Massive Multiplayer RPG") root.geometry("200x100") #initialize root window root.mainloop() #if session is > 0: #Get Player Info UserName = "Brian Flores" Password = "enterprise" rank = 32 #planetOverview planetName = "Earth" plasmaOnhand = 1000000000 titainiumOnhand = 340000 crystalOnhand = 55000000 magneticEnergyOnhand = 350000 ecosystem = "No" # yes or no depending on wars or natural disasters that could have damaged or destroyed your ecosystem if there is no ecosystem the atmosphere must be cleaned up and another must be transplanted from another world. ecosystemDamage = 10000; #Damage can result from experiments, wars, natural disasters. At 10,000 damage the ecosystem goes extinct. You can repair this damage my researching technologies and building machines to do such repair # else: # print "You are not logged in!"; # raw_input() Well for some reason it's not working. All I am doing here is setting some vars and using the root.tk function. If anyone has any Ideas or tips to get this basic script working let me know. Thank you, DaRedHead
  25. The information on the php.net documentation seems to be out of date. http://php.net/manual/en/faq.databases.php#faq.databases.mssql as the link to the necessary libraries for Linux is broken. Can you tell me, or point me to what is needed to connect to MSSQL with PHP 5.3.3/Apache on Red Hat Linux If there is more than one option, we would like to know what they are and the installation details. Thanks
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.