Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 167753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:19:53+00:00 2026-05-11T12:19:53+00:00

Here is proof that my site is not portable. I had some regex that

  • 0

Here is proof that my site is not portable. I had some regex that worked perfectly on my old server. I have now transferred my site to a new server and it doesn’t work.

$handle = popen('/usr/bin/python '.YOUTUBEDL.'youtube-dl.py -o '.VIDEOPATH.$fileName.'.flv '.$url.' 2>&1', 'rb');  while(!feof($handle)) {     $progress = fread($handle, 8192);     $pattern = '/(?<percent>[0-9]{1,3}\.[0-9]{1,2})% of (?<filesize>.+) at/';     ///######Does not execute this if - no matches     if(preg_match_all($pattern, $progress, $matches)){     fwrite($fh, $matches[0][0].'\r\n');     } } 

The output of the from the shell is something like this and the regex should match filesize and percentage.

[download]  56.8% of 4.40M at  142.40k/s ETA 00:13 

The regex worked on the previous server but not this one. Why? How can I debug this?

The difference in the servers is that the previous one was Fedora and its now Centos. Also I specified the shell as /bin/bash.

Is there anything in the PHP.ini that could cause a change in this?

Please help.

Update

The output of $progress is this: (just a small sample)

[download] 87.1% of 4.40M at 107.90k/s ETA 00:05  [download] 89.0% of 4.40M at 107.88k/s ETA 00:04  [download] 91.4% of 4.40M at 106.09k/s ETA 00:03  [download] 92.9% of 4.40M at 105.55k/s ETA 00:03 

Update 2

Could that regex fail because of extra spacing in the output?

Also would a different shell make a difference??

[SOLVED]

This was solved and it was due to the regex requiring a P – see here for more details: Does this regex in PHP actually work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T12:19:54+00:00Added an answer on May 11, 2026 at 12:19 pm

    Is the output from the working or non working server? It’s possible safe mode is enabled on the second and the script is refusing to execute. Check the Notes section on this page for more information http://us.php.net/popen

    To verify, and I do see the comments where you placed the output of the python command, print out the $progress variable in the php script. I’m not sure if the output you supplied is when you ran the python command from cli or got that from the php script itself. But if it’s from the python script outputting that $progress variable will help determine if popen() is really executing that command.

    (You should be able to tell if safe mode is enabled by running phpinfo() in your script)

    Or you could do this

    if( ini_get('safe_mode') ){     print 'safe mode on\n'; }else{     print 'safe mode off\n'; } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the scenario. I have a working VSX package Proof of Concept that
I have a proof-of-concept that is thoroughly and utterly broken here: http://jsfiddle.net/floyd_may/FAmxj/ I'm hoping
As a proof of concept here's some console output first: ruby-1.9.2-p180 :010 > x
I have some proof concept code for a HTTP module. The code checks to
Here is the code: create table `team`.`User`( `UserID` bigint NOT NULL AUTO_INCREMENT , `Username`
Here is the Javascript I currently have <script type=text/javascript> $(function() { $('.slideshow').hover( function() {
Here is my SQL script CREATE TABLE tracks( track_id int NOT NULL AUTO_INCREMENT, account_id
I have an object, RenderComponent , that has a property named Model that is
I have an application that needs to render about 100 flash graphs (as well
edit: I should probably say how I am currently worked around the problem here.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.